Hi there,
I have a problem with texture mapping on a cube mesh.
I load a texture (not in the opengl thread):
BufferedImage image = ImageIO.read(new File(texture));
tData = TextureIO.newTextureData(image, false);
// save in list
textureData.add(tData);
// returns the index of the saved texture data.
return textureData.size()-1;
In my Cube Mesh I call:
if(texture != -1){
gl.glBindTexture(GL.GL_TEXTURE_2D, texture);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGB, 64, 64, 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, TextureController.getInstance().getTextureDataBufferAt(texture));
gl.glBindTexture(GL.GL_TEXTURE_2D, texture);
}
At the gl.glTexImage2D Command I got the following exception:
java.lang.IllegalArgumentException: Illegally formatted version identifier: “null”
What am I doing wrong here?
I initiate the texturing like this:
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
gl.glTexEnvf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
kind regards
Knut