PDA

View Full Version : Partial transparency on tga texture map



Cyrom
06-27-2002, 05:57 AM
I am have a problem with the transparency of my texture. In my program, I am mapping a background
texture(bmp), then placing icons (tga) on top of this background. The tga icon images have transparent backgrounds (RGBA), however, when they are placed on top of the background texture, what ever color is selected fills the background. Therefore, insted of the underlying texture, I am seeing the selected color. I have attempted alpha tests, glblend, popattributes, and much more. The furthest I have gotten is when I change the color to color4f(0.0,0.0,0.0,0.1) after the glblend. This gives me complete transparency of my background, however, also enables some transparency of my actual icon as well. If any one has run into this situation before, I would greatly appreciate the help.
Thanks,

Jeffry J Brickley
06-27-2002, 06:39 AM
It would help to see an example of what you are talking about, either code segment or preferably image. I use blending all the time for a variety of full transparency to partial. Cloud textures within my particle engine use RGBA textures quite well.

Are you using glDrawPixels() to copy the RGBA information to the screen or are you texturing tris to place them on the screen? If you are using textured tris, are you setting the icon's z value different than the background?

Relic
06-27-2002, 07:03 AM
Sounds like the color of the quad you use to draw the textured icon is showing through.
The default TexEnv mode is GL_MODULATE.
Try setting the incoming color to full white (1,1,1,1 and lighting disabled) and enable alpha test, disable blending.

The resulting alpha will be
A_result = A_fragment * A_texture;
For A_texture == 0 and alpha test set to draw if alpha > 0 this will mask the transparent.

(In case I misread the intention and you're using multitexture, look for "register combiners" on the forum.)

Cyrom
06-27-2002, 07:26 AM
Thanks, that got me on the right track. I appreciate the help


Originally posted by Relic:
Sounds like the color of the quad you use to draw the textured icon is showing through.
The default TexEnv mode is GL_MODULATE.
Try setting the incoming color to full white (1,1,1,1 and lighting disabled) and enable alpha test, disable blending.

The resulting alpha will be
A_result = A_fragment * A_texture;
For A_texture == 0 and alpha test set to draw if alpha > 0 this will mask the transparent.

(In case I misread the intention and you're using multitexture, look for "register combiners" on the forum.)