Results 1 to 2 of 2

Thread: Min/Mag filtering on texture edges

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2004

    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.

    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.


    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)?

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2004

    Re: Min/Mag filtering on texture edges

    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.

Similar Threads

  1. Nearest texture filtering tiled texture
    By imported_tksuoran in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 03-02-2012, 06:01 AM
  2. Texture gap filtering in Z
    By umugl in forum OpenGL: Basic Coding
    Replies: 13
    Last Post: 04-24-2008, 05:20 PM
  3. texture filtering
    By Peter Maarssen in forum OpenGL: Basic Coding
    Replies: 23
    Last Post: 02-07-2008, 08:35 AM
  4. Texture filtering
    By clunis_immensus in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 04-24-2002, 03:12 AM
  5. How can i texture a polygon with more then 4 edges ??
    By Matl2000 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 05-15-2001, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean