4th color component in glClearColor

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…

a) For completeness.

or

b) For destination alpha buffer?

I dont know. Just listing suggestions.

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

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.

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

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