Min/Mag filtering on texture edges

I have what I believe not to be a unique problem, but am struggling to find a solution (other than work-arounds that don’t achieve the original desired effect). I would love to be enlightened as to what I am missing here, or better, yet, to be told that my problem really is fairly common and there isn’t an easy solution. I hope I am not this braindead. :slight_smile:

Basically I’m trying to create a window (IE a gui window) in an app that allows for multiple resolutions. Since I also want the windows to retain their size through different resolutions, already that implies I will need filtering to get the edges and corners to appear smooth if using textures to create them (which I am).

What I’m trying to accomplish is similar to creating a “window” in HTML via supplying a table with edges and corners created in JPEG, GIF format, whatever. I have one rounded graphic for the corner, and another straight graphic for the edges.

The corner looks like a quarter of a donut. It connects with the side and top “edges” of the window.

My problem is that when filtering is applied, it ruins the continuity of the colors when in GL_CLAMP mode, and ruins the transparent edges of the images when in GL_REPEAT mode. In other words, I get colored edges where it should be completely transparent because of the nature of the filtering process- I realize that the filter must supply a texel from somewhere and it does this via repetition or via border colors in CLAMP mode.

To summarize, I believe I understand the problem and why this is happening. I just can’t find a solution other than turning off filtering, which provides continuity and correcty transparency, but looks ugly. What I believe I WANT is to have filtering enabled for the inner portion of the textures, but not the edges. This, I think, would allowed the edges and smoothness of the corners to exist while leaving the edges un-filtered to connect correctly with the other textures.

Is this possible? Or am I just using a method to create a “window” that really is obsolete? I’d appreciate any tips.

EDIT:

I’ve come to admit that maybe, as ugly of a solution as it sounds, the answer is using borders and border colors. However I’m having an EXTREMELY tough time finding good information on how to use it. I’ve read the red and blue book details on it and personally I find it extremely vague. I still fail to even understand how border colors are read in from a texture and supplied to the renderer. Is this perhaps the answer? If so, how do I supply the data and contain it in my image files that are normally powers of 2 (32x32)?

Solution: GL_CLAMP_TO_EDGE!

This worked for me… I feel good about it. Didn’t know this existed- apparently it just doesn’t sample the edges when using linear filtering and thus seems to be exactly what I needed. It does produce the desired effect.

Hope my ramblings help someone.