I did not understand several parts of the code that I looked at from one of the articles. One of those parts were the "N<<=1" in the for loop. The other part is in the next part, outside of the for loop. Why do the variables for the rgb16->position.rgbBlue, rgb->position.rgbRed, and
rgb->position.rgbGreen equal what he made them equal. And why does rgb->position.rgbBlue = 0? Anyway, the code is in the next post. By the way, don''t comment on some of the syntax errors in the code. I took it directly from an article.
firstly N<<1 multiples N by 2. << is the shift left operator. ie it shifts the variable a certain number of places to the left. eg if you have the binary number 0010 and use 0010<<1 you get 0100. As each digit is a power of 2 this multiples the number by two. In the example 2 becomes 4. Hope that makes sense.
For the second part, this is because of how the colour information for the pixel is stored. For 16 bit pixels it is usually RRRRRGGGGGGBBBBB. The mask that DDraw returns is 1111100000000000 for red, 11111100000 for green and 11111 for blue. The for loop sets B to 5, G to 6 and R to 5 ie the number of bits for each colour value. BTW the code in the for loop is wrong, the second and third bitmasks should be for green and blue respectively.
The start position for red is therefore the number of bits for green and the number of bits for blue. ie g+b. The start position for green is the number of bits for blue ie b. As blue is the first colour its start position is 0.
This may be better explained in the 16bit pixel plotting articles here on GameDev.net under the developer resources section.
No sense being pessimistic. It wouldn''t work anyway.