Jump to content
  • Advertisement
Sign in to follow this  
shekharpk19

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

This topic is 5069 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ???

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!