LWJGL Forum

Programming => OpenGL => Topic started by: the2bears on August 08, 2005, 05:59:58

Title: Fading effect
Post by: the2bears on August 08, 2005, 05:59:58
Here's a question I can't find the answer to:

Can I get alpha blending with glClearColor(...)?

GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glClearColor(0f, 0f, 0f, 0.5f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT );


This doesn't seem to do anything other than clear the screen to black.  What I'd like to do is set up a fade effect, where rendered pixels slowly fade out due to the background clear.

Perhaps another way?  A full-screen texture instead?  

Bill
Title: Fading effect
Post by: tomb on August 08, 2005, 10:22:45
Blending don't work with glClearColor. All it does is fill the color buffer with the specified values. You'll need to draw fullscreen quad with your alpha/color. No need to use a texture.
Title: Fading effect
Post by: the2bears on August 08, 2005, 14:58:10
Ah... that makes sense of course.  Thanks!

Bill