View Full Version : Clamping Textures - NVidia / ATI

11-07-2003, 06:06 AM
I have a range of textures that I need to apply to an object. The object has one face that has texture coordinates, the remaining faces don't.
Each texture is bordered in a single color. So if I bind the texture to my object, the face is textured and the rest of the object, I assumed, is rendered in the border color of the texture.
I noticed the other day that some textures were causing wrap artifacts so I clamped the texture.
Now on NVidia cards it all works as before without the artifacts but on ATI cards, the face is rendered correctly but the rest of the object is black !
How should I approach this problem ... is it wrong to assume that the rest of the object is rendered in the border color of the texture ? ... I think that I just did it at the time and found that it worked !


11-07-2003, 11:48 AM
There are three clamping modes in OpenGL :

GL_CLAMP_TO_EDGE : the border texture is never used, the first and last lines and columns of the texture are teared instead. Requires the GL_EXT_texture_edge_clamp extension, GL_SGIS_texture_edge_clamp extension, or OpenGL1.2

GL_CLAMP_TO_BORDER : the border of the texture is always used outside the [0,1] range. Requires the GL_ARB_texture_border_clamp extension, or OpenGL1.3

GL_CLAMP : the standard clamping mode which samples the border only when "needed". But most of the time that's not what programmers expect. That's why old nVidia drivers forced the CL_CLAMP behaviour to copy the GL_CLAMP_TO_EDGE behaviour. Now since detonator 40.x (I think it's 40 but I may be wrong) you can configure the driver for either using GL_CLAMP as the real one described in the spec, or as a copy of the GL_CLAMP_TO_EDGE behaviour.

Read the specifications for more details about the difference between the three modes.

11-08-2003, 12:52 AM
Thanks ... that makes sense now ...