I’m trying to get my Tiles working unter jogl.
I’m loading the Tileimage with the TextureIO class like
file = new File("res/set1.png");
texture = TextureIO.newTexture(file, true);
and try to render them to a quad with
texture.enable();
texture.bind();
gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
TextureCoords coords = texture.getImageTexCoords();
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(coords.left(), coords.bottom());
gl.glVertex2f(0, 0);
gl.glTexCoord2f(coords.right(), coords.bottom());
gl.glVertex2f(texture.getImageWidth(), 0);
gl.glTexCoord2f(coords.right(), coords.top());
gl.glVertex2f(texture.getImageWidth(), texture.getImageHeight());
gl.glTexCoord2f(coords.left(), coords.top());
gl.glVertex2f(0, texture.getImageHeight());
gl.glEnd();
texture.disable();
viewport is set up with glu.gluOrtho2D(0, 800, 0, 600); all the rest is form the JOGL demos.texture.
set1.png is 529x387 pixel and I thougt getImageWidth() and getImageHeight would give me those values, instead the return me the same values as getWidth() (1024) and getHeight() (512). trying to get subImages form this Texture with the right Dimension don’t even compile.
Can somebody please tell me what wrong with my code?