Jump to content
  • Advertisement
Sign in to follow this  
TrueTom

Texture has seam

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a problem with textures: If I draw a textured quad at the size of 512x512 with a texture of 256x256 it gets a seam around it. Only solution so far is to disable texture interpolation (GL_LINEAR). I googled for a while now but it seems I'm the only one who has this problem? The texure is part of a 512x512 texture. Regards Thomas

Share this post


Link to post
Share on other sites
Advertisement
I know ATI cards have an option to enable "Alternate Pixel Center", but that's only for Direct3D. The problem might be with your graphics card specifically. What graphics card do you have?

Share this post


Link to post
Share on other sites
@Mark: Thanks, but I already used 0...

@evanofsky: It's a GF4... It looks like the last row of the image and the next line in the bigger texture (currently just a yellow color) get interpolated together (that seems reasonable because normally you would continue to use the texture on the next polygon).

Share this post


Link to post
Share on other sites
Quote:
Original post by TrueTom
@Mark: Thanks, but I already used 0...

@evanofsky: It's a GF4... It looks like the last row of the image and the next line in the bigger texture (currently just a yellow color) get interpolated together (that seems reasonable because normally you would continue to use the texture on the next polygon).


Well in that case, try altering the clamp mode for the texture glTexParameteri

GL_TEXTURE_WRAP_T/GL_TEXTURE_WRAP_S with GL_CLAMP

Of course I read somewhere you should suck in the pixel uvs by 0.32xxx or some strange value to compensate for filtering. I personally never liked doing that, and instead add 0.5 to the x,y vertex coordinates. (this seems to work in directx too)

Share this post


Link to post
Share on other sites
I already tried GL_CLAMP but also doesn't work, because it interpolate the borlder with the pixel line of the opposite side border...

It's seems CLAMP_TO_EDGE_EXT would do the job but I can't try it out at the moment (Opengl 1.2)...

Share this post


Link to post
Share on other sites
then your opengl probably supports gl_clamp_to_edge_sgis extension? the constant is same as gl_clamp_to_edge.. otherwise just live with seams and make gl_clamp_to_edge work properly on better opengl implementations.

edit:

use clamping texture edges like this:

procedure ClampBorders(const yes: boolean);
begin
if yes = false then begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
end else begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
end;
end;

this works tested on Geforce 4 mx440...
do this for every texture while creating it.

btw, geforce 4 supports opengl 1.5 at least, get new drivers from nvidia.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!