Alpha Channel

Member
Posts: 110
Joined: 2002.04
Post: #1
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 );

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #3
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?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL Alpha Channel Problem Moganza 1 3,170 Jan 19, 2013 08:25 AM
Last Post: sealfin
  Trouble writing PNGs with 16 bits per channel using libpng flash 2 3,868 Aug 28, 2006 11:01 AM
Last Post: flash
  Using 8-bit greyscale texture as an alpha channel? TomorrowPlusX 12 5,010 Apr 10, 2006 08:43 AM
Last Post: TomorrowPlusX
  Alpha Channel Woes GraySupreme 5 4,283 Jul 26, 2005 01:24 PM
Last Post: NYGhost
  png without alpha fine, png with alpha, nothing dave05 6 6,892 Jun 11, 2005 10:31 AM
Last Post: dave05