Results 1 to 2 of 2

Thread: texture problem--transition layers on the boundary

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    18

    texture problem--transition layers on the boundary

    Hi,
    I am using 4*4 texuture. The upper 3*3 texels are pure red(RGB1,0,0)), the others are pure green(RGB0,1,0)). I am using the following setting:
    glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
    And then I draw a square and mapped it to the texture,
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0); glVertex3f(0.0, 0.0, 0.0);
    glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 0.0, 0.0);
    glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0,0.0);
    glTexCoord2f(1.0, 0.0); glVertex3f(0.0, 1.0, 0.0);
    glEnd();
    But I saw a transtion layer on the boundaries. I can understand the transition layer in the interface of the two colors. But Why there are transtion layers near the boundaries? What should I do if I want to keep the transition layer on the interface, but not on the boundary?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: texture problem--transition layers on the boundary

    GL_CLAMP interpolates to 50% of the border color (black by default).
    To avoid this, use GL_CLAMP_TO_EDGE.

Similar Threads

  1. having a problem with fonts and abusive transparency-layers
    By Tcll5850 in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-26-2014, 11:26 AM
  2. Smoothing the boundary
    By jenny_wui in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-25-2013, 08:50 AM
  3. rectangle on the boundary
    By suriogl in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-10-2008, 06:49 AM
  4. Full speed texture layers on GeforceFX
    By mderdem in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-26-2003, 03:40 AM
  5. Zigzag Boundary
    By Rajiv Mishra in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 09-07-2001, 09:21 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