Texture.getImageWidth() / getImageHeight()

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?

The mipmap generation process is causing your top-level image to be rescaled to the next largest power of two along the x and y dimensions. You should be able to get the dimensions you’re looking for by creating a TextureData out of the file, querying it for its width and height, and then creating a Texture object from it; you can discard the TextureData immediately afterward.

Thank for the hint!

Since I only use them for 2D purposes I just create them without mipmap generation and it works fine for me so far.