Simulating CLAMP_TO_BORDER with 1.2


I’m using the texture matrix and the CLAMP_TO_BORDER texture wrapping parameter in order to set the correct pixel-aspect-ratio of an image on a texture, hiding the superfluous pixels with the default TEXTURE_BORDER_COLOR. The problem is that on some platform using the DRI, CLAMP_TO_BORDER which is OpenGL 1.3 specific doesn’t exist as an extension, and I want to keep the same behavior.

Do you know the best method to simulate CLAMP_TO_BORDER on those OpenGL 1.2 platforms ?


Have you tried GL_REPEAT instead of GL_CLAMP. It does help for me if the texture is 1-to-1 mapped.

You may also modify GL_TEXTURE_BORDER_COLOR:
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
The problem is the colour of border is only monotone(single colour).

Last, try to set UV-coords a little inward, for example, (0,0) to (0.05, 0.05) and (1,1) to (0.95, 0.95).