PDA

View Full Version : GLint internalFormat vs GLenum format in gluBuild*DMipmaps(), glTexImage*D() etc ...



Olumide
02-05-2002, 05:35 AM
The parameters GLint internalFormat and GLenum format (found quite often in texture related functions) seem to mean the same thing to me. I wonder if you could be kind enough to help me sort out the difference.

ThanX

Bob
02-05-2002, 07:15 AM
The internal format is the format the texture should be stored in when uploaded. The format (or external format) is the format your data is stored in.

As for internal format, you should not bother about this. Keep it as generic as possible. You should let the driver choose the best storage format for optimum performance. If you want a color texture with three color channels, just set it to GL_RGB and let the driver decide the exact format. Whether it's internally converted to a 16 bit interleaved format, 24 or 32 bits, is nothing you should care about. The driver knows what's best.

The external format is, as I said, how YOU store the image in system memory. This format, along with the type (the parameter after format) must exactly match the image data. This tells OpenGL how the data is stored, what it contains, how to extract the data, and so on.