PDA

View Full Version : can't pick out alpha value in frame buffer



koradji
10-20-2005, 05:51 AM
hi,everyone
i have codes like this:

// set back color
glClearColor(0.0,0.0,0.0,0.0);

glColor4f(0.6,0.6,0.6,0.5);
// draw something
....
....
glFinish();
// now we want to get the pixels in frame buffer
glReadPixels(0,0,win_sizex,win_sizey,GL_RGBA,
GL_UNSIGNED_BYTE,pixel_buf);
....
....

code is finished,but whatever we set the params in glColor4f, the alpha value stored in
the pixel_buf is always 1.0, so how can i properly get the alpha value in the frame buffer?

thanks!!!

Aeluned
10-20-2005, 06:15 AM
Have you specified a pixel format descriptor with an alpha plane?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_73jm.asp

koradji
10-20-2005, 03:21 PM
yes! just check the pixelformat,
I use glut, so I set GLUT_ALPHA when
glutInitDisplayMode,it runs good.
thanks!