PDA

View Full Version : Checking for GL_MAX_TEXTURE_IMAGE_UNITS



piperfloyd
08-14-2009, 06:32 PM
Hello,

I'm fairly new to OpenGl, but the project I am working on right now requires me to start exploring it.

I know that GL_MAX_TEXTURE_IMAGE_UNITS will tell me the max texture image units that my video card supports, but is there a way to know how many are in use?

Thanks for your time,

piperfloyd

Ilian Dinev
08-14-2009, 07:56 PM
For each unit, for each target, you glGetIntegerv for the bound texture and whether it's enabled. It's generally useless to know how many are in use.

Dark Photon
08-14-2009, 08:05 PM
I know that GL_MAX_TEXTURE_IMAGE_UNITS will tell me the max texture image units that my video card supports, but is there a way to know how many are in use?
What do you mean "in use" exactly?

If you are using the fixed-function pipeline, you can query which texture units are enabled and which are disabled. That'll tell you which ones will be used the next time you draw something.

If you are using shaders, you can really kinda do the same thing. But you may be asking how many textures a specific shader makes use of, even before you've actually set up your texture units to draw with that shader. In which case you can iterate over the uniforms and see which of them are samplers.

If you need more specific help, please follow-up with whether you're doing fixed-function pipeline or shaders here, and someone will help you out.

piperfloyd
08-17-2009, 10:50 AM
Thanks, for the answers. I am new to OpenGl, so my understanding of things is still flaky. I realized now though that I don't really need to know how many textures are in use. thanks