# Fixing texture seams without GL_CLAMP_TO_EDGE extension

This topic is 2516 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone,

I'm currently working with a graphics API that only support REPEAT and CLAMP modes for texturing. I get those ugly seams that are caused by filtering. Any idea how to fix the seams without using a CLAMP_TO_EDGE extension?

##### Share on other sites
Create a border on the texture with the edge pixels repeated. If you also use mip-mapping it's a bit of a waste if you need many mip-levels.. perhaps you can do it in a shader, if you're using them?

##### Share on other sites
By ugly seams, do you mean a tear effect or the edges looking dirty?

EDIT:-

For now I'll assume dirty edges, if you want to do this without the extension you'll need to pinch your UVs in by half a normalized texel width/height, because the texel centre is 0.5, and of course 1.0 is 0.0, if that makes any sense.

Using 0-1 for uv's and if you have a primitive moving slowing sub pixel level you'll find the top and left will appear to have a cropping artefact and bottom and right will appear to have a pulsating halo artefact.

Hope this makes sense and I hope I've not misinformed.

##### Share on other sites

By ugly seams, do you mean a tear effect or the edges looking dirty?

EDIT:-

For now I'll assume dirty edges, if you want to do this without the extension you'll need to pinch your UVs in by half a normalized texel width/height, because the texel centre is 0.5, and of course 1.0 is 0.0, if that makes any sense.

Using 0-1 for uv's and if you have a primitive moving slowing sub pixel level you'll find the top and left will appear to have a cropping artefact and bottom and right will appear to have a pulsating halo artefact.

Hope this makes sense and I hope I've not misinformed.

I'm having that weird effect when moving a camera around.
How do I move it half a normalized texel? I have something like

 float p1 = sprite_origin.X/texture_width; float p2 = sprite_origin.Y/texture_height; float p3 = sprite_origin.Right()/texture_width; float p4 = sprite_origin.Bottom()/texture_height; 

I'm assuming it's not just adding 0.5f right?

##### Share on other sites
I had the same trouble once, I have a 3D plaza on my blog and you can see the edges on the sky box, i used to use texture coordinates to not display the edges for example use 0.03 instead of 0 and to use 0.92 instead of 1, but i remember you coul still see where joined the both textures. When i used gl_clamp_to_edge the problem was solved but i had another issue that i can remember right now,
I will be watching this post to see the correct answer
by the way this is the project
http://vasilydev.blogspot.com/2011/08/3d-square-with-opengl-and-c.html

##### Share on other sites
sorry not been around for a while so missed this post.

given your uv's are 0 -> 1 and your texture is 64x32 then uadj = 0.5 / 64 vadj = 0.5 / 32

then assuming a clockwise order.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013739
×