Hello!
I have the following problem: My engine used to support just one image format, BMP. I implemented the loader myself and transferred the data to the gfx card with the following code:
//loading part
int texObjID = getNewTextureObjectID(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, texObjID);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, texture.width, texture.height, 0, texture.format, texture.type, texture.getImageDataAsByteBuffer());
//in the drawing part
gl.glBindTexture(GL.GL_TEXTURE_2D, texObjID);
Everything worked fine, no problems.
Today I decided to switch to TextureIO für image loading as I want to support more formats.
The texture code was replaced with this:
//loading part
TextureData texData = TextureIO.newTextureData(new FileInputStream(imageFile), false, fileSuffix);
Texture texture = TextureIO.newTexture(texData);
texture.setTexParameteri(GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
texture.setTexParameteri(GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
//in the drawing part
texture.bind();
My test object is a cube. The (bmp) image seems to be ok, but the mapping to the cube is messed up(corners are mapped to the center of the sides).
I did not touch any other code…I expected it to work without further changes, where is my mistake?
Thanks in advance,
kez