I am having a problem that I think is possibly to do with texture coordinates, the image below shows my tile map being rendered – however sometimes there are gaps appearing between the tiles as can be seen in the screenshot at the following url (Half way down the screen there is a gap between tiles).
http://img15.imageshack.us/img15/4724/tileproblem.png
My texture regions are declared as
public class TextureRegion {
public final float u1, v1;
public final float u2, v2;
public final Texture texture;
public TextureRegion(Texture texture, float x, float y, float width, float height) {
this.u1 = x / texture.width;
this.v1 = y / texture.height;
this.u2 = this.u1 + width / texture.width;
this.v2 = this.v1 + height / texture.height;
this.texture = texture;
}
}
The tile textures come from an atlas and are 32×32 pixels, I am using GL_Nearest
being new to Open GL, I do not quite understand what I need to change.
Example of texture creation
tile = new TextureRegion(items, 192,160,34,34);
Cheers
Stuart
Make sure your texture are base 2, for example 128×256 or 512×512 etc.