Critical error in handling bit packed textures

ImageComponet is able to carry the 16 bit RGB4 or RGBA4 formats.

But for the gl.glTexImage2D(…) call the internalFormat is specified correctly but for the user format the general format (e.g. GL_RGB, GL_RGBA) is specified.

Because ImageComponetXX knows that RGB4 is 16bit it only allocates the size for widthheight2 but OpenGL expects widthheight3 ! which leeds to an invalid memory access and the death of the JVM.

I’m currently working on the texture code and this crash must be fixed. I didn’t find a way to transfer RGB4 to OpenGL, I will change ImageComponentXX so that it will store the pixels unpacked (eg RGB8).

This will result in a little API mess because the format of an ImageComponent won’t represent the format of the byte[] data but what will be used in OpenGL.

Currently the Texture.getFormat() will be used to specify the format of the byte[]. This is not good because data and format are stored in two different classes.