View Full Version : Help with glTexEnv*

12-06-2003, 09:54 AM
I'm using a brick texture for a quad in an app I'm developing for class. I have to add a doorway as well though. I don't want to add extra geometry though, I want to use the effect mentioned in the Red Book on quad billboarding. (using a picture of foliage, mapping to a quad) I'm pretty sure I have to use the glTexEnv* calls but I'm not sure where to go from there. Also I'm using tga's for this texture, I'm curious if there is anyway to incorporate the alpha channel in it if I save it all as a 32-bit.

12-06-2003, 12:38 PM
tga support alpha channel.

So you have a texture of brick and another with a door and a part you don't want to see in the rendering or you have just the brick texture and you want a transparent part of it????

12-06-2003, 12:50 PM
Well I have a brick texture and I want part of it to be transparent (doorway). But wasn't sure if I had to do something with actual targa file and/or something within the app, like a call to glTexEnv?

Does that make sense what I want to do?

12-06-2003, 02:04 PM

i have never used tga before in my prog but if you know how to set a part of the picture with alpha=0 (the transparent part) and another part with alpha=1, you should use alphaTesting (not texEnv).
To accept only framgent with alpha different to 0, call :

_ glEnable(GL_ALPHA_TEST);
_ glAlphafunc(GL_NOTEQUAL,0);

I think it's the best way to do what you want but the problem is the alpha channel in tga : i have never used it.

PS : me, i use bmp with a specific color(0,255,0 for exemple) who will be the transparent color. At the loading, i set alpha=0 if the fragment is equal to this color and finally i send the color buffer to the graphic card(the bufer contains r,g,b,a data).

[This message has been edited by sebh (edited 12-06-2003).]

12-06-2003, 04:59 PM
I took the image into photoshop and erased it and saved it off as a 32bit file and then made those changes and your advice worked exactly like I had hoped.

Thanks again

12-07-2003, 12:28 AM
I like help others because i like when others help me ;-)