Getting max number of multitextires

Is there a way for me to query my graphics card to determine the maximum number of multitextures it supports? Only the first four seem to be working, so I’m presuming that’s all I have, but it would be nice to have confirmation from the hardware.

How many multitexture levels do most cards have?

this should do the job:


int getNumTexturesSupported(GL gl) {
  int[] mins = new int[2];
  gl.glGetIntegerv(GL_MAX_TEXTURE_UNIT, mins, 0); 
  gl.glGetIntegerv(GL_MAX_TEXTURE_COORDS, mins, 1);
  return min(mins[0], mins[1]);
} 

In OpenGL, texture unit may mean different things ;

  • a texture coordinates generator/interpolator unit (which provides texture coordinates), queried with GL_MAX_TEXTURE_COORDS,
  • a texture image unit (which provides texture data), queried with GL_MAX_TEXTURE_IMAGE_UNITS,
  • a full texture unit for fixed function pipeline, composed of a texture coordinates generator/interpolator + a texture image unit, queried with GL_MAX_TEXTURE_UNITS,
    Depending on your needs, just performs the according query.
    For example on a GeForce 5200FX, you get 4 full units, but there are 16 image units.

As far as I know, you need to use shaders to access the full set of texture image units, they are not exposed through the fixed function pipeline.