glDrawPixels and Color Control

I use glDrawPixels to draw an array of pixels.

Image[i][j][1]=value; /green
Image[i][j][2]=value; /blue
Image[i][j][3]=value; / red


I want blue pixels and white pixels. The blue ones shall have values of 8bit (0…255). But I am confused. When I set green “plane” to 255 and/or red “plane” to 255, I get strange colors. When I put red and green plane to 0, I get blue pixels (different brightness as I want) on BLACK pixels. But I want them on WHITE pixels.

How does CONTROLLED RGB mixing with glDrawPixels work?? I´d appreciate your help!!

The format needs to match your array interleaving. With GL_RGB 0 = red, 1 = green, 2 = blue. With GL_BGR it’s the other way around.

With the C language arrays are numbered from 0, perhaps you’re using fortran but it’s worth mentioning. Even assuming fortran your array indexing is bogus. If it’s C than this would only compile with an array of minor dimension 4 which means [3] would be alpha (with an RGBA or BGRA format).

I wish you’d get more specific in future, you don’t show your array declaration and you don’t even bother to fill out your drawpixels arguments.