PDA

View Full Version : interpolation overflow box around 32 bit texture



AE
04-03-2005, 06:48 PM
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); //helps 2 sides.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//Create 32 bpp texture that has an alpha channel that acts as a mask. The alpha channel in the image is set to 0 for every area on the image that is pink.

//Drawing Texture
glColor4f(1,1,1,1); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//Draw texture

Now I know I could use glAlphaFunc(GL_GREATER, .7f); but that looks horrible and does not work with a semi-transparent image and an alpha channel.

Using GL_TEXTURE_WRAP's fixes the top and left but the bottom and right still have an interpolation overflow line at the outer edges of the image.

How do I fix this?

dorbie
04-03-2005, 10:09 PM
You have been told repeatedly and at length what the problem is in other threads on this site and at gamedev.

Either fix your source image or resolve your zbuffer issues with a depth sort.

Post a screenshot and we'll be able to tell you which is the problem.

One fix (if your content is OK) is to disable blending altogether but keep the alpha test, you won't get soft edges but you won't have any depth vs blend sort conflicts. One game which does this for example is World of Warcraft if you look at all the vegetation.

AE
04-04-2005, 04:23 AM
I think you are thinking of the halo problem around the outline of the character shape. That was fixed with the flood fill. This is the same EXCEPT it's on the outer edge of the image and flood filling can't fix it because it is straight lines running along the side and bottom of the image caused by GL_LINEAR overflow.

I'll try to post a screenshot.

AE
04-04-2005, 05:03 AM
I found it. I was not making the padded part of the texture's alpha channel 0. That fixed the lines. Thanks for being patient with me.