Hey.
Went through the 3d Asteroids tutorial and think i understand most of it.
Anyways Im trying to make a 2d side artillery game just to get a better feel for the engine.
im generating a random terrain in two stages, first a 2d array of 1 and zeroes used for collision detection and secondly a .png image to place as a backdrop on the screen.
I'm drawing a the background using.
private void drawBackground(GameWindow window) {
window.enterOrtho();
databank.getBackgroundStillImage().bind();
int x = ((int) player.getX()) - world.getMaxXWidth();//- world.getMaxXWidth()-850);
int y = ((int) player.getY() - 15) ;
System.out.println(((int) player.getX()) + " x "+ ((int) player.getY()) +" - - "+x + " . " + y + " img: "+ databank.getBackgroundStillImage().getImageWidth()+"x"+databank.getBackgroundStillImage().getImageHeight() );
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0,1);
GL11.glVertex2i(0-x,0+y);
GL11.glTexCoord2f(0,0);
GL11.glVertex2i(0-x,world.getMaxYHeight()+y);
GL11.glTexCoord2f(1,0);
GL11.glVertex2i(world.getMaxXWidth()-x,world.getMaxYHeight()+y);
GL11.glTexCoord2f(1,1);
GL11.glVertex2i(world.getMaxXWidth()-x,0+y);
GL11.glEnd();
window.leaveOrtho();
}
As you can see im adding and subtracting the width and height of the image just to get it into the place it is now...
Even so, for some reason this does not seem to be on the same scale as when i draw my 3d model (thats done in the same way as showed in the 3d asteroids game tutorial,
http://www.cokeandcode.com/asteroidstutorial)
GL11.glTranslatef(positionX,positionY,0);
My image is 400x400 pixels big.
When i get the image to line up with my world's 0,0 (bottom left) the top right corner of the image is not at 400, 400.
It is instead around 300x300.. it s like the image is being scaled down.
Not sure whats causing it, most likely im doing something wrong, documentation isent exactly heavy so what i have now ive mostly gotten by testing.
Heres a picture to help explain ( im still using the space ship model in the tutorial untill i can make my own

)
The ship in the picture is at the edge of the world, 400 x 400 but the image is not, when im at 0,0 i have gotten it to align
I placed the red box in the image to check if i was stretching it..

The output below is from the system.out visible in the code.