glClearColor & glClear dont seem to give proper results!!!

Started by
2 comments, last by ProPuke 19 years, 3 months ago
When i clear the backbuffer using glClear and GL_BLEND enabled , does OpenGL actually perform blending? I thought it should , because glClearColor takes the alpha component as fourth parameter . bUt that does not seem to happen ... the whole screen is painted with the new color and nothing that was previously drawn is seen through the new layer of color !! Does anyone have some idea on how to get glClear working ???
Advertisement
Quote:Original post by shekharpk19
When i clear the backbuffer using glClear and GL_BLEND enabled , does OpenGL actually perform blending?


No. It just inconditionally writes the clear color to the buffer.

Quote: I thought it should , because glClearColor takes the alpha component as fourth parameter.


It'll set the alpha value in the color buffer. Some blending modes do use the target alpha value.

Quote:Does anyone have some idea on how to get glClear working ???


For what you want to do, it's not glClear() that you need, but to render a colored quad over the whole scene.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
thats how it works, it just replaces all the pixels in the buffer with the values you set up.

If you want to blend you'd have to draw a screen aligned quad over the old image with blending active.
That's how glClear Works. It's an instant wash of the buffer. It takes an alpha component because gl supports rgba rendering. Meaning aswell as rendering colour to the drawbuffer it also has an alpha component for each pixel - usefull for rgba texture generation etc. glClear just washes the entire surface.
For extra functionality like that wash the screen yourself - switch to an ortho mode & wash a quad over the screen ;]

extra :: lols everyone makes the same reply
extra :: extra :: wow & only 1 second difference between fruny & teh phantom
_______________________________ ________ _____ ___ __ _`By offloading cognitive load to the computer, programmers are able to design more elegant systems' - Unununium OS regarding Python

This topic is closed to new replies.

Advertisement