Hi all!
I’m trying to use the new TextureData/Texture classes, instead of using the glTexImage calls and stuff. However, I stumbled upon a problem. I created a new TextureData object using a null Buffer parameter. Then I created a new Texture :
TextureData textureData = new TextureData(GL.GL_RGB,
128,
128,
0,
GL.GL_BGRA,
GL.GL_UNSIGNED_BYTE,
false,
false,
false,
null, // BufferUtil.newByteBuffer(4*Terrain.IMAGE_TEXTURE_SIZE*Terrain.IMAGE_TEXTURE_SIZE),
null);
texture = TextureIO.newTexture(textureData);
The equivelant using the old way is :
int[] texs = new int[1];
gl.glGenTextures(1, texs,0);
textureID = texs[0];
gl.glBindTexture(GL.GL_TEXTURE_2D, textureID);
long l = System.nanoTime();
gl.glTexImage2D(GL.GL_TEXTURE_2D,
0,
GL.GL_RGB,
128,
128,
0,
GL.GL_BGRA,
GL.GL_UNSIGNED_BYTE,
null);
By using the old way, texture space could be allocated directly to the GPU without transferring data to it. Texture data could be provided later by glCopTexImage calls. However, when I tried to do the same using the new code, the VM crashed. It crashes at the Texture creation, and not at the TextureData constructor call.
Is this a bug, or am I doing something wrong here? I think that a Texture should be created using TextureData with null texels (since texture dimensions and format have already been specified). I’m using the lastest nightly build.
TIA
N