[HOpenGL] Querying GL info, including # of texture units.

Sven Panne Sven.Panne at aedion.de
Mon Jul 6 12:24:37 EDT 2009


Am Samstag, 4. Juli 2009 02:13:30 schrieb Conal Elliott:
> I'm looking for a way to query the number of available texture units to
> shaders.  In C, I think the value can be extracted with
> glGetIntegerv<http://www.opengl.org/sdk/docs/man/xhtml/glGet.xml>passing
> in GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS.

It depends on your use case if this is the correct part of the OpenGL state. 
Depending on the shaders where you use the texture units, you should use one 
of:

   GL_MAX_TEXTURE_IMAGE_UNITS
   GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS
   GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB
   GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS

> There are also getInteger1 and GetMaxCombinedTextureImageUnits in
> Graphics.Rendering.OpenGL.GL.QueryUtils, but that module isn't exported
> from the OpenGL package.
>
> Have I missed something?

Yes. ;-)

   http://hackage.haskell.org/packages/archive/OpenGL/2.2.3.0/doc/html/Graphics-
Rendering-OpenGL-GL-Shaders.html#v%3AmaxCombinedTextureImageUnits

To find something in the OpenGL package, simply drop the "GL_" or "gl" prefix 
and use camelCase. Another way to find API entries is the structure of the 
OpenGL spec, which is mirrored in the module hierarchy. If you still can't 
find it, I consider this a design and/or documentation bug in my package which 
I'll happily fix.

Cheers,
   S.



More information about the HOpenGL mailing list