Currently, the quads are an isometric shape (64x32), as are the textures I'm trying to use. The image I'm using is 512x512 and holds 8 tile textures on a single row with the capability of holding 16 rows, so I've tried changing the texture coordinates to fractions but they just do not show the full texture (or any texture at all).
public void draw(int x, int y, int tex_x, int tex_y) {
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 31/32); //GL11.glTexCoord2f(0, 0.5f);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(1/16, 1); //GL11.glTexCoord2f(0.5f, 1);
GL11.glVertex2f(x+32, y+16);
GL11.glTexCoord2f(1/8, 31/32); //GL11.glTexCoord2f(1, 0.5f);
GL11.glVertex2f(x+64, y);
GL11.glTexCoord2f(1/16, 15/16); //GL11.glTexCoord2f(0.5f, 0);
GL11.glVertex2f(x+32, y-16);
GL11.glEnd();
}
The code above is what I'm currently using, though I've tried a bunch of other ways (the commented coordinates work when using a single image). It doesn't even show the textures on the screen. The code is attempting to get the first tile on the top row of the image.
Other coordinates I've tried have gotten only a very tiny amount of the texture onto the quad.
This is the image I'm using:

I'm fairly new to OpenGL and texturing has been the biggest pain for me so far, so any help would be greatly appreciated.

New Topic/Question
Reply



MultiQuote



|