• Advertisement

Archived

This topic is now archived and is closed to further replies.

effects of alpha in clear colour

This topic is 5936 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

please hold the abuse throwing for a few seconds * what is the point of the alpha value in glClearColor()? * what effects can it have if used correctly? * is it a dud? you may now start throwing abuse if you think it is necesary to the cause "For Queen and Country!" Edited by - aleks_1661 on November 18, 2001 10:22:03 PM

Share this post


Link to post
Share on other sites
Advertisement
> what is the point of the alpha value in glClearColor()?

To clear the alpha buffer ?

Hum it does sound a pretty st... range question

Y.

Share this post


Link to post
Share on other sites
Well the color buffer is not just RGB, it can be RGBA, so you can assign a value to A too. As for the effects, well, you can do stuff with the alpha test, the blend function ...

Share this post


Link to post
Share on other sites
im not stupid. when you make a call to glClear() it fills the buffer with the specified colour but alpha seems to have no effect.


To clear the alpha buffer ? it makes no difference, in every test i have done.

In every book i have read it has not been used i thought it might be able to fade a scene, by clearing with less alpha each time, but it just clears the damn thing to black anyway. i need some usefull information.


"For Queen and Country!"

Share this post


Link to post
Share on other sites
Ah, but then you have to change your blending function so that the alpha in the image masks the alpha of the pixels you render instead of the opposite.

glBlendFunc( src, dst )

src is used as a multiplier to the color of the pixel you are rendering, and dst as a multiplier to the color already in the image buffer

The "usual" :
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA )

Only the alpha of the pixel you are drawing matters (*_SRC_ALPHA). High alpha increases the weight of the pixel you are drawing, hence the opacity.

For a fadein, (never tried, but ...)

glBlendFunc( GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA );

Only the alpha of the pixel already in the image matters (*_DST_ALPHA). High alpha increases the weight of the pixel already in the image, hence its opacity.

There are more combos you can play with. Check the Blue Book, pages 112-115

Share this post


Link to post
Share on other sites
Here''s something to try...

In your PIXELFORMATDESCRIPTOR, set it to overlay.
Then give a clear alpha.
See what it does.

Share this post


Link to post
Share on other sites

  • Advertisement