GLSL max number of texture units per pass

Started by
4 comments, last by Grazer2 14 years, 6 months ago
Hi, just wondering how to query the maximum amount of textures that can be bound and used for rendering. For some reason it looks i can only use 5 tex units when i actually need 6. I just wanna find out if its a hardware limitation or if there is anything else that's wrong. For some reason the 6th unit just returns all white in my shader. Right now I have
projective_texturing_shader_.sendUniform1i("tex5", 5);
in my C++ code which yields the white texture i described. If i put
projective_texturing_shader_.sendUniform1i("tex5", 0);
the unit does have a valid (non white) texture which obviously equals the one from texture unit 0. I just don't get what's wrong there
Advertisement
If used more than 5 (perhaps 8)
I dont know if theres a fast limit, check the back of the opengl spec for the tables to see how to query the number of texture units u can use in a shader.
IIRC most hardware supports 16

So I assume youre doing something incorrect in your code
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB,&value);

This will return the number of texture units (which differs from card to card).
Quote:Original post by AndyEsser
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB,&value);

This will return the number of texture units (which differs from card to card).


Thanks, this one returns me a 32 so the hardware should support it (as I already imagined).

The textures I bind are the 6 color attachments of a single framebuffer object (I already queried that my hardware supports 8 attachments, so thats not the problem). Anybody knows of any limitations with this specific set-up?
Are you certain that the 6th colour attachment is correctly set up? Are you able to see it if you apply it if you don't use the Shader approach?
Quote:Original post by AndyEsser
Are you certain that the 6th colour attachment is correctly set up? Are you able to see it if you apply it if you don't use the Shader approach?


I can use the texture from the 6th colour attachment just fine in my shader if i bind it to texture unit 0.

This topic is closed to new replies.

Advertisement