Texture borders problem with blending

Hi all,
I’m writing a pseudo-2D engine using OpenGL.
I have a problem with blended (bilinear filtered) textures… if I don’t enable the filter on the textures I notice absolutely no problems. If I enable the filter I notice that (if the texture has been painted in a way in which left and right borders are very different (say one black and one white)) there seem to be pixels of the right border in the left border and vice versa. I think that this is a common problem, but I would like to know if there is some kind of solution to it (we have tried everything like exchanging the texture borders pixel and so on, but with really little results).
Notice that the problem applies also on up and down borders! And also, not on all the gfx boards the effect is exactly the same (on some gfx board is very evident and on some other is less relevant).
Thank in advance.

Well, think about what bilinear filtering does. It blends adjacent texels together linearly to get the texture’s color at that pixel. So, if it uses adjacent texels to blend, what happens when it tries to blend an edge’s texel values?

That’s what texture border colors are for. You can set a single border color for your texture to use for this outside-texture color. Also, you could enable GL_REPEAT (I think this solves it). The simplest thing would be to change your texture coordinates from (0.0, 1.0) to ( (1 / textureWidth or Height), 1.0 - (1 / textureWidth or Height) ). This keeps the polygon from accessing any texel values that fall outside of the texture for bilinear filtering. However, the sprite texture will be stretched slightly. If the texture’s width and height aren’t the same, you may notice some slight distortion.