Thread: One pointer that does not work as expected

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    screenDataPnt is (screenWidth * screenHeigth * 4) which in my case is 640*480*4

    Your image data is stored in BGRA format? I think you want to swap the bytes you read for B and R in the for loop.
    My data is stored in BGRA, so that part is correct.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    More of a coding style thing, but:
    Code:
    		blue[i]  = *(texture + 0);
    		green[i] = *(texture + 1);
    		red[i]   = *(texture + 2);
    		trans[i] = *(texture + 3);
    I find it clearer to use index formatting:
    Code:
    		blue[i]  = texture[0];
    		green[i] = texture[1];
    		red[i]   = texture[2];
    		trans[i] = texture[3];
    When you say "more and more corrupted", can you describe what happens to the data?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  3. The Bludstayne Open Works License
    By frenchfry164 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-26-2003, 11:05 AM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM