Textures depth

How do we choose to use 16 or 32bit textures under OpenGL? It as nothing to do with glTexImage2D(), or does it?

Originally posted by KRONOS:
How do we choose to use 16 or 32bit textures under OpenGL? It as nothing to do with glTexImage2D(), or does it?

It’s one of the arguments to glTexImage2D, the internalformat (sometimes called components) argument. Pass in GL_RGB5 or GL_RGB8 for RGB textures, and pass in GL_RGBA4 or GL_RGBA8 for RGBA textures. If you use GL_RGB or GL_RGBA, the driver picks the color depth to use.

  • Matt