Strange Lines on texture

Hi, I am loading a 1024x512 png image and drawing it on the screen. when I translate it, sometimes a strange grey line shows along it.
Does anyone know what the problem is?
image: http://www.use.com/2dc0018cea8a9b9306d7
Thanks,
roland

image(link) doesnt work

hmm…

http://www.use.com/2dc0018cea8a9b9306d7

If you are tiling the texture, did you try clamp to edge?
If you are using texture positions of <0 or >1 instead of tiling, are you sure there isn’t a semi transparent line in there?
Do you have one or multiple textures within one file?

Mike

GL_CLAMP_TO_EDGE?

Thanks for the replies.
I wasn’t using >1 or <0 texture coords, but the clamp fixed it :slight_smile:

Am I right that I have to put it just before the draw call each time? I tried to put it in my opengl init function and it didnt do anything?
eg.


        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
        GL11.glBegin(GL11.GL_QUADS);

Thanks again,
Roland

Due to interpolation, it is entirely possible for OpenGL to sample outside of the bounds of your texture coordinates. GL12.GL_CLAMP_TO_EDGE fixes this. GL11.GL_CLAMP only clamps texture coordinates to 0.0-1.0, so it doesn’t do anything to prevent interpolation outisde of 0.0 - 1.0. Try it. =D

No problems, I’m just happy that I can have some use of the knowledge I built up from trial and error :slight_smile:

Put it where you first create the texture and not at every draw.

Mike

Does this mean I have to switch everything to 1.2?

Thanks :slight_smile:

You don’t have to change the texture coordinates at all. Why on Earth would you want to change it to 1.2 in the first place?

You effectively change your runtime requirements to GL1.2, but you don’t have to change anything in the code, just use GL12.GL_CLAMP_TO_EDGE and you are done.

Make sure you add a check to make sure that the capability for 1.2 is there before calling that.

Mike

How exactly ?
I would use GL11.glGetString(GL11.GL_VERSION); and then check

Yeah I have this line problem too, but only if I scale the whole screen, which is still experimental
I think its because the positions aren’t accurate enough anymore - but using Slick not sure this CLAMP will help me there.

if (GLContext.getCapabilities().OpenGL12){

}

Wow. Eternal embarrassment to me then. ._.

Thanks :slight_smile: