Nitram wrote:
Uh... careful there.
For the format of offscreen-images: all cool
Forcing the texture format of and image to something different: problems in most cases.
Doing such a thing requires to convert the textures BEFORE they are load into the textures. Else the byte data does not match.
Within limits the PNG decoder is able to perform such conversations. But not for any and all cases.
For example there is no equivalent in PNG pictures to the OpenGL mode "ALPHA" or the "INTENSITY" mode.
Nitram
With glTexImage2D we can provide two formats:
internalFormat - Used to specify how OpenGL should store the texture internally in vram
format - Used to specify what kind of format OpenGL should expect from the input ByteBuffer (I don't plan on changing this)
In other words, say we load an RGBA image from a PNG file. The
format needs to match the PNG file, so it needs to be RGBA, but we can specify a different format to store the texture internally, such as GL_LUMINANCE, GL_RGB, or GL_RGB4 (taking up less memory and usually rendering more efficiently). It also provides a simple manner of converting to grayscale on the fly.
See the bottom of this page for details:
http://www.flipcode.com/archives/Advanc ... ping.shtml