Strange texture borders. I guess because of GL_TEXTURE_WRAP_S

Started by
1 comment, last by HuntsMan 14 years, 9 months ago
Hi friends! Using Qt 4.5 and VS2005, OpenGL widget and a PNG texture with alpha channel, I see strange borders and I guess it is because bilinear filtering (I guess when filtering a borders, the method takes just the another border pixels also.) I change GL_TEXTURE_WRAP_S from GL_REPEAT to GL_CLAMP, and although it is better, I still see artifacts in my object borders. And if I set filtering to GL_NEAREST there are no artifacts. I read this on opengl docs: "GL_TEXTURE_WRAP_S Sets the wrap parameter for texture coordinate s to GL_CLAMP, GL_REPEAT, GL_CLAMP_TO_BORDER_EXT, or GL_CLAMP_TO_EDGE_EXT. GL_CLAMP causes s coordinates to be clamped to the range [0, 1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. GL_CLAMP_TO_BORDER_EXT causes s coordinates to be clamped to a range 1/2 texel outside [0, 1]; this prevents the "half border, half edge" color artifact. GL_CLAMP_TO_EDGE_EXT causes s coordinates to be clamped to a range 1/2 texel inside [0, 1]; this prevents any border colors from showing up in the image. Border texture elements are accessed only if wrapping is set to GL_CLAMP or GL_CLAMP_TO_BORDER_EXT. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT." But it seems Qt does not support GL_CLAMP_TO_BORDER_EXT . Any idea or suggestion? Thanks in advance! Image Hosted by ImageShack.us<br/>
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
Advertisement
qt should support GL_CLAMP_TO_BORDER_EXT I dont see why not,

u can change border colors check the spec for the method the default color is black (what u see there)

what you should try is GL_CLAMP_TO_EDGE, since GL_CLAMP_TO_BORDER will give you a black border which is not what you want
Quote:Original post by ricardo_ruiz_lopez
But it seems Qt does not support GL_CLAMP_TO_BORDER_EXT .


How are you reaching that conclusion? Qt doesn't implement OpenGL, neither wraps it, QGLWidget just gives you a way to create a OpenGL context in a cross-platform way.

This topic is closed to new replies.

Advertisement