PDA

View Full Version : 4th color component in glClearColor



KRONOS
06-13-2002, 04:10 AM
Changing the values of the alpha component in glClearColor(...), with a RGBA color buffer doesn't change a thing. So, what the hell is it for?!

Thanks....

Nutty
06-13-2002, 04:14 AM
a) For completeness.

or

b) For destination alpha buffer?

I dont know. Just listing suggestions.

kon
06-13-2002, 04:33 AM
Well, how do you know that it doesn't work? This is how I do it:
After setting up a rendering context call:


int n;
glGetIntegerv(GL_ALPHA_BITS, &n);
n should be 8 for 8 bit alpha buffer.

now after calling glClear(GL_COLOR_BUFFER_BIT | ...) get a pixel's alpha value by


GLubyte ubAlpha;
glReadPixels(10, 10, 1, 1, GL_ALPHA, GL_UNSIGNED_BYTE, &ubAlpha);

this works for me.

kon

KRONOS
06-13-2002, 06:00 AM
Well, render a scene, but before swapBuffers, clear de screen with glClear(0.0f,0.0f,0.0f,0.3f). Guess what?! It clears the whole buffer black. Totally black.

kon
06-13-2002, 06:07 AM
Kronos,
glClearColor(0.0F, 0.0F, 0.0F, .5F); specifies the values. glClear() the buffers to be cleared! e.g. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

kon

ehart
06-13-2002, 07:28 AM
Originally posted by KRONOS:
Well, render a scene, but before swapBuffers, clear de screen with glClear(0.0f,0.0f,0.0f,0.3f). Guess what?! It clears the whole buffer black. Totally black.

What are you expecting it to do? The buffer should be black after that. The destination alpha should also be 0.3. Are you expecting it to blend somehow? Clear doesn't generate fragments like rendering, so blending and texturing don't apply. The only things that apply IIRC are scissor, masking, and drawbuffer.

-Evan