Results 1 to 3 of 3

Thread: Problems with textures and borders

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2006
    Posts
    16

    Problems with textures and borders

    I have a problem with my textures. It seems as it has a border. I think that the colour of the border is take from the texture. The coordinates of the texture i'm using are between 0 and 1 (i control this).

    I use this for create textura, so i don't use any border.

    glTexImage2D ( GL_TEXTURE_2D,0,GL_RGB4, Width, Height, 0,GL_RGB, GL_UNSIGNED_BYTE, data);
    Image

    Thanks

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: Problems with textures and borders

    If you image data doesn't specify border pixels, a single border color (which defaults to black) is used. The texture coordinates 0 and 1 fall right in the middle between the left/bottom border and the first pixel, and the last pixel and the right/top border. Thus the combination of a texture withou border and GL_CLAMP texture wrap mode causes the outer edge of the texture to be blended with a constant border color. That's what you see in the screenshot.

    You can fix this by
    • Providing explicit border pixels that copy the adjacent edge of the neighboring texture.
    • Specifying texture coordinates from 1/2n to 1-1/2n, where n is the texture width/height in pixels.
    • Using texture wrap mode GL_CLAMP_TO_EDGE, which limits the texture coordinates to the range mentioned above.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2006
    Posts
    16

    Re: Problems with textures and borders

    Thanks alot!

Similar Threads

  1. NPOT DXT1 textures with borders?
    By andras in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-12-2006, 11:28 AM
  2. Texture borders on GL_RGBA32F textures (ATI bug most likely)
    By Pentagram in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 12-29-2005, 03:00 PM
  3. Black borders around clamped textures
    By Ketracel White in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-25-2004, 10:50 PM
  4. element borders with textures
    By guju in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 06-19-2002, 02:00 AM
  5. sub-textures (mosaics), borders, and filtering...
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-23-2002, 03:31 AM

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