Amit Assaraf
Amit Assaraf

Reputation: 504

LWJGL - White border on my 3D quads when they are like 10f away from camera pos

I get weird white borders on my 3D quads when they are a little ways away from the camera position and when they are close the borders disappear...

Upvotes: 0

Views: 254

Answers (1)

Mac70
Mac70

Reputation: 320

Make sure that you are using power-of-two textures as non-power-of-two textures may cause problems with texturing.

Try replacing this fragment:

GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 
        GL11.GL_NEAREST);

with this:

GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 
        GL11.GL_LINEAR);

You can also try replacing this:

GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

with this:

GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

I think the problem may be in in texture coordinates - how do you initialize them and do you change them while program is running? Texture coordinates may have values only from 0 to 1 and in most cases these are not changing while program is running.

Upvotes: 1

Related Questions