PDA

View Full Version : GL_LINEAR and transparent texture



list67
04-04-2003, 07:17 AM
I wish I could post a picture of this, but here goes. I have a signle texture that is something like the following.
______________________
| |
| Transparent Area |
| |
| =========== |
| | Opaque | |
| | Area | |
| =========== |
| |
| |
----------------------

When displayed with my OpenGL program, the "Transparent Area" is all transparent, but all around the border of the "Opaque Area" there is a white border that "fades" into the colors of the "Opaque Area".

I've tried various texture and blend settings. GL_BLEND with glBlendFUnc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) just changes the border color from white to more of the color of the "Opaque Area".

When I open the image with Gimp and zoom in to see the pixels there is no "white border" of pixels between the opaque area and the transparent area.

Any ideas of what is going on, or how to get rid of the border around the opaque area?

list67
04-04-2003, 07:22 AM
The above picture didn't turn out as I had hoped.

dummstah
04-04-2003, 07:24 AM
I had a similar problem with sprites in my engine when I used ALPHA_TEST. My sprites would have a white border around them.

There wasnt so much of a white border when I used blending, but there was still traces of the color from the texture that surrounded the opaque areas.

The culprit was my texture filtering. I changed sprites to GL_NEAREST and it removed the white border, but obviously the sprites were blocky.

list67
04-04-2003, 09:04 AM
Same blockiness here with GL_NEAREST. Maybe there is a blending option that will fix it for GL_LINEAR.

04-05-2003, 12:25 AM
When loading the transparent texture. Change the color of transparent pixels to black, 0 0 0. That should fix your problem.