View Full Version : Texture border (2nd try...)
05-09-2001, 06:55 AM
I compile the 'Checker' program from the red book (chapter 9) with a small change: use filter mode of GL_LINEAR (instead of GL_NEAREST). The right texture appears with a grey border (I guess because of interpolation of black pixels in the right and up sides with white pixels in the left and bottom sides).
How can I avoid this artifact?
Use GL_CLAMP_TO_EDGE if you don't want the border color to get filtered in at the edge. This is core functionality in OpenGL 1.2, but you need to use the GL_SGIS_texture_edge_clamp extension if you want this functionality in OpenGL versions < 1.2. The clamping enumerant in that case, is of course GL_CLAMP_TO_EDGE_SGIS.
Hope this helps...
05-09-2001, 10:18 PM
Still, using 'EDGE_TO_CLAMP' doesn't help. I saw it when I defined a red border to the texture. When NOT using this extenstion the border's color was redish. When using it the border was grey as described in my 1st letter. It DOES help when using GL_NEAREST and not GL_LINEAR.
Furthermore, It seems that it is impossible to define GL_REPEAT and GL_CLAMP_TO_EDGE at the same time (probably contradiction), But this is really what I want: To render a texture in repeat mode but with no edges at all.
Is there any solution to this problem?
In GL_REPEAT mode, the border color is not used at all. There is no need to use the GL_CLAMP_TO_EDGE extension, and as you noticed, you can't.
im curious with the newer nvidia drivers is GL_CLAMP the same as GL_CLAMP_TO_EDGE. what i mean is the driver will use GL_CLAMP_TO_EDGE even if u ask for GL_CLAMP
On GeForce3 GL_CLAMP gives you GL_CLAMP behavior. On GeForce2 GL_CLAMP gives you GL_CLAMP_TO_EDGE behavior. This will be a problem for some apps that use GL_CLAMP but expect GL_CLAMP_TO_EDGE behavior. This problem will be especially noticable with cube maps.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.