PDA

View Full Version : glColorMask (nvidia driver 28.32)



ToolTech
06-17-2002, 01:34 AM
It seemes to me as the nvidia driver 28.32 uses CMY instead of RGB in the glColorMask command. When using glColorMask(TRUE,FALSE,FALSE,FALSE) i get a cyan a like output ?????

Am I doing wrong or is it a bug ?

/Anders Modén

dorbie
06-17-2002, 01:40 AM
This should only write the red component, however even when working it could still produce cyan. For example if you have a white screen and draw on that depending on the value of red written the result will vary from cyan to white bacause the green and blue components will remain at full intensity.

ToolTech
06-17-2002, 01:51 AM
You are right. I forgot the background ? My mistake. So stupid I am . Have don this several times before but now I had a major brain breakdown !

Thanx !

ToolTech
06-17-2002, 11:34 AM
Actually I get this faulty background/foreground because the following code snippet gives no output. Exchange the gzXXX with glXXX and you get OpenGL syntax. When I enable the color map LUT i get zero output (no pixels copied) from the back buffer to the front buffer ??

gzVoid onPostRender(gzContext *context, gzULong size_x , gzULong size_y)
{
gzMatrixMode(GZ_PROJECTION);
gzLoadIdentity();
gzMatrixMode(GZ_MODELVIEW);
gzLoadIdentity();

gzDrawBuffer(GZ_FRONT);

gzFloat scale[256];

for(int i=0;i<256;i++)
scale[i]=i/256.0;

gzPixelMapfv(GZ_PIXEL_MAP_R_TO_R,256,scale);
gzPixelMapfv(GZ_PIXEL_MAP_G_TO_G,256,scale);
gzPixelMapfv(GZ_PIXEL_MAP_B_TO_B,256,scale);

gzPixelTransferi(GZ_MAP_COLOR,GZ_TRUE);

//gzPixelTransferf(GZ_RED_SCALE,0.5);
//gzPixelTransferf(GZ_GREEN_SCALE,0.5);
//gzPixelTransferf(GZ_BLUE_SCALE,1);
//gzPixelTransferf(GZ_ALPHA_SCALE,1);

gzRasterPos2d(-1,-1);
gzCopyPixels(0,0,size_x,size_y,GZ_COLOR);

gzDrawBuffer(GZ_BACK);

setEnableSwap(FALSE); // Disable swap in double buffer

}

ToolTech
06-17-2002, 11:59 AM
Ok. Found it myself. Forgot the ALPHA mapping. Thanx anyway for a great forum...