Alpha Channel
What is the proper way to get GL to draw alpha channels in textures.
Im loading a PNG with an alpha... that works fine in RAVE
and looks like its loading with teh proper GL setting in
glpng.c
But when rendered I get no alpha effects of any type.
And Yes I have been looking though all my books and online FAQs and
its still not clear to me what I should do here
Help me PLEASE!!!!! :-)
- FOLLOW UP -
It alll seems to be working using this...
// TEXTURE SETTINGS //
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND );
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.0 );
But Im not clear on what the GL_APHA_ TEST is doing
since most of the code I saw before this did not have me
turning these two on at all.
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.0 );
Im loading a PNG with an alpha... that works fine in RAVE
and looks like its loading with teh proper GL setting in
glpng.c
But when rendered I get no alpha effects of any type.
And Yes I have been looking though all my books and online FAQs and
its still not clear to me what I should do here
Help me PLEASE!!!!! :-)
- FOLLOW UP -
It alll seems to be working using this...
// TEXTURE SETTINGS //
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND );
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.0 );
But Im not clear on what the GL_APHA_ TEST is doing
since most of the code I saw before this did not have me
turning these two on at all.
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.0 );
When you load the texture, do you set the internal format to GL_RGBA in your call to glTexImage2D?
That particular alpha test setting will throw away a pixel if it has an alpha of zero, rather than doing the work of blending it with the contents of the framebuffer. It won't change what things look like, but it will speed things up if you have textures with completely transparent texels.
That particular alpha test setting will throw away a pixel if it has an alpha of zero, rather than doing the work of blending it with the contents of the framebuffer. It won't change what things look like, but it will speed things up if you have textures with completely transparent texels.
Quote:Originally posted by OneSadCookie
When you load the texture, do you set the internal format to GL_RGBA in your call to glTexImage2D?
For the ones with and Alpha channel yes.
Ok how about telling me how you would set up your context and textures
for using alpha channels in a game?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL Alpha Channel Problem | Moganza | 1 | 1,442 |
Jan 19, 2013 08:25 AM Last Post: sealfin |
|
| Using 8-bit greyscale texture as an alpha channel? | TomorrowPlusX | 12 | 4,275 |
Apr 10, 2006 08:43 AM Last Post: TomorrowPlusX |
|
| Alpha Channel Woes | GraySupreme | 5 | 3,780 |
Jul 26, 2005 01:24 PM Last Post: NYGhost |
|
| png without alpha fine, png with alpha, nothing | dave05 | 6 | 5,685 |
Jun 11, 2005 10:31 AM Last Post: dave05 |
|
| Multiplying a fragment against values in the alpha channel | TomorrowPlusX | 2 | 3,272 |
May 19, 2005 04:27 AM Last Post: TomorrowPlusX |
|

