I’ve just started writing a 2D game, my first with lwjgl, and I noticed that the image I loaded was a bit skewed. The image was much wider and shorter than it should be. The image is a 24-bit png. The projection setup I’m using looks like this:
GLU.gluOrtho2D(0, Game.gameWidth, 0, Game.gameHeight);
I’m trying to map an image to a quad so that the corners of the image meet up with the corners of the quad, code looks like this:
GL11.glPushMatrix();
GL11.glTranslatef(x, y, 0);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(1f, 0); GL11.glVertex2f(400, 0);
GL11.glTexCoord2f(1f, 1f); GL11.glVertex2f(400, 400);
GL11.glTexCoord2f(0, 1f); GL11.glVertex2f(0, 400);
GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0);
GL11.glEnd();
GL11.glPopMatrix();
I tried a different image that doesn’t use transparency and it draws a black square the actual size of the image with the actual image occupying the lower-lefhand side of that square, heres a screen:
http://www.cyntaks.com/projects/images/misc/screen.png
the current color is set to red, so I don’t know why the square is black. Btw, I’m using KevGlass’s TextureLoader class from space invaders 104. Any ideas?