Strange Borders

Started by
3 comments, last by VanKurt 22 years, 7 months ago
Hi folks ! I''ve got something strange going on..... My terrain is made up of tiles (16*16 Vertices, TriangleStrips). Each of these tiles has got it''s own texture, what looks very good, BUT: Around each texture tile, there is a thin border (width 1 pixel), that has only one color (this color seems to be mixed out of all colors in the texture). If I put together these texture-tiles in Photoshop, there is NO border, so I''m shure that OpenGL is screwing something up.... Has anyone an idea, how I can solve this prob ??? Thanks, VanKurt
Advertisement
If it''s what I think it is, this is OpenGL''s way of making the texture tile-able.

I.e. when you are trying to have a texture, of size 1x1, cover an area 4x4, OpenGL can be set to automatically blend this edge texel so that when the texture is "repeated" there is no noticeable edge (or at least not quite as visible without it). I guess if your texture is already made in this way, this feature might be inconsequential.

What you''ll be using is GL_REPEAT -
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

What you want is GL_CLAMP -
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );

Though this has the problem that when specifying texture coordinates, you can only use values between 0 and 1 or it continues the edge texel off to whenever...

Hope this is what you mean.
Then again, I just re-read your post and think I got totally the wrong idea... whoops
Hey, where are you OpenGL-Wizzard-Gurus ? ;-)

Perhaps there is something wrong with my openGL texture-settings...?
Is this the problem (+solution) you are having? (Text from ATI''s page: http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/rage128sdk/OpenGL/EXT_texture_edge_clamp.html )

OpenGL® Extension: EXT_texture_edge_clamp
Many game developers using OpenGL® are surprised to learn that when using GL_CLAMP with any form of bilinear texture filtering, any bilinear fetches that fall outside of the range of 0.0 to 1.0 cause the border color to participate in the bilinear filter. The EXT_texture_edge_clamp extension causes bilinear fetches outside of this range to be ignored (identical to Direct3D''s clamping behavior).

Essentially, using this extension (after confirming it is supported with a call to glGetString(GL_EXTENSIONS)) is as simple as passing CLAMP_TO_EDGE to TexParameterx().

For complete details on this extension, please refer to the official EXT_texture_edge_clamp specification.

Dirk =[Scarab]= Gerrits

This topic is closed to new replies.

Advertisement