Texture Alpha Channel
I'm working off the nehe basecode:
What do I need to do so that the alpha channel in my targa texture's will draw as transparent? Right now they're completely ignored. I've been at this for days and just can't figure out whats wrong. Shouldn't I just have to call:
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_NOTEQUAL, 0.0);
What else is it I need to do?
I put an NSLog in the texture loading function so I can verify that it is recognizing it as having an alpha channel and storing it as RGBA.
If need be, I'll post the source on the net.
What do I need to do so that the alpha channel in my targa texture's will draw as transparent? Right now they're completely ignored. I've been at this for days and just can't figure out whats wrong. Shouldn't I just have to call:
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_NOTEQUAL, 0.0);
What else is it I need to do?
I put an NSLog in the texture loading function so I can verify that it is recognizing it as having an alpha channel and storing it as RGBA.
If need be, I'll post the source on the net.
Quote:Originally posted by Holmes
I've been at this for days and just can't figure out whats wrong.
Step 1: read the manual.
http://www.opengl.org/developers/documen...index.html
In particular, "Per-Fragment Operations:Blending."
Quote:
What else is it I need to do?
Step 2: turn on blending.
glEnable(GL_BLEND)
Step 3: pick a blending function.
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
I have blending enabled, with that same mode you stated too.
I have the red book so I do indeed read the manual. I find it little help at all at most times. The red book is quite cryptic in that sometimes it doesn't even define its own terms, and it rarely adresses real world situations. I'll read what you suggested, however, and report back.
I have the red book so I do indeed read the manual. I find it little help at all at most times. The red book is quite cryptic in that sometimes it doesn't even define its own terms, and it rarely adresses real world situations. I'll read what you suggested, however, and report back.
I fixed the problem. Turns out Nehe's texture loading code doesn't actually handle alpha...Anyway, I fixed it by writing up some code that handles TGA files specifically.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL Alpha Channel Problem | Moganza | 1 | 1,409 |
Jan 19, 2013 08:25 AM Last Post: sealfin |
|
| Pasting an image with alpha mask on a texture | Najdorf | 10 | 5,014 |
Jun 24, 2008 03:23 PM Last Post: Najdorf |
|
| Using 8-bit greyscale texture as an alpha channel? | TomorrowPlusX | 12 | 4,273 |
Apr 10, 2006 08:43 AM Last Post: TomorrowPlusX |
|
| Alpha Channel Woes | GraySupreme | 5 | 3,777 |
Jul 26, 2005 01:24 PM Last Post: NYGhost |
|
| png without alpha fine, png with alpha, nothing | dave05 | 6 | 5,672 |
Jun 11, 2005 10:31 AM Last Post: dave05 |
|

