PDA

View Full Version : Texture unit number difference



Nil_z
09-12-2004, 10:50 PM
I am using a NV5700U, when I query for the max texture units supported with GL_MAX_TEXTURE_UNITS_ARB, I get 4. But in the DX Caps Viewer, it says MaxSimultaneousTextures is 8. I wonder if these two things actually have different meanings. If not, why I get different results in opengl and DX?

CrazyButcher
09-13-2004, 12:33 AM
afaik more texture units are still available but only using programmable pipeline
ie fragment shaders/programs
they want to support the use of shaders which makes the texture stuff more effecient or so... dont know exactly why

Jan
09-13-2004, 01:08 AM
What you asked under OpenGL, will give you the number of REAL texture units, meaning, that you also get texture-coordinates etc.

If you use a fragment shader, you can usually use more textures, than you have texture units. You only get 4 texture coordinates, which you can interpolate, but usually you only need one texture coordinate or two, to access every texture.

Under OpenGL you can ask for GL_MAX_IMAGE_UNITS or so, which should give you the same number, which you get under DX.

Check out the fragment program spec, there you should find all necessary information.

Jan.

09-13-2004, 12:17 PM
just to correct a minor typo, it's glGetIntegerv with

total number of texture images:
GL_MAX_TEXTURE_IMAGE_UNITS_ARB

and while i'm at it ...

total number of texture coordinate sets:
GL_MAX_TEXTURE_COORDS_ARB

total number of texture units complete with matrix and environment function:
GL_MAX_TEXTURE_UNITS

note that you can only enable/disable units up to GL_MAX_TEXTURE_UNITS. units from GL_MAX_TEXTURE_UNITS to GL_MAX_TEXTURE_IMAGE_UNITS_ARB are always enabled.

as jan said, it's all in the spec:
http://www.opengl.org/documentation/spec.html

you just have to dig for it ;)

09-13-2004, 12:28 PM
by the way, only d3d9 imposes the limit of 8. on fx hardware, you have 16 total image units with gl, 4 texture units, and 8 coordinate sets.