Fading effect

Started by the2bears, August 08, 2005, 05:59:58

Previous topic - Next topic

the2bears

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
the2bears - the indie shmup blog

tomb

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.

the2bears

Ah... that makes sense of course.  Thanks!

Bill
the2bears - the indie shmup blog