Hello I’ve been trying to access multiple textures within the fragment program, the problem is that when I use glUniform1iARB to bind a texture to any TU besides 0 it gives me error 1281 “Invalid Value”. I use glGetUniformLocationARB to find the sampler2D position so I know the sampler position should not be what is generating this error, especially since I can bind the same position to TU0 and it works fine.
I’m using basically the exact methods shown in the Orange Book. I think there is something wrong with my C++ code because my computer should be able to do 4 textures and 16 texture image units. I downloaded a bump mapping GLSL demo from Nvidia and I was able to compile it and it works fine with 3 textures, they are using the same method to set up the shaders as I am. Is there some secret trick or bug to this?
This is all the fragment program does, textureUnit and textureUnit2 always use the same texture because I cannot get it to bind to any besides TU0.
Thx for tips,the code is rather long but the shader itself is compiling correctly, I check it for errors with glGetObjectParameterivARB after each shader is added to the program. Once it links properly I check validation, call glUseProgramObjectARB() and then attempt to bind the uniforms like this…
int loc = glGetUniformLocationARB(hProgamObject,“textureUnit”);
glUniform1iARB(loc,0);
int loc2 = glGetUniformLocationARB(hProgamObject,“textureUnit2”);
glUniform1iARB(loc2,1);
^ this is where GLenum err = glGetError(); returns 1281 “Invalid Value”. loc2 is equal to 39 which seems correct, the program contains an array of 38 uniform matrices and these 2 uniform samplers.
Originally posted by yooyo:
[b]Can you tell us your hw and driver. If you have 38 matrices it uses 38*4 (=152) vec4 in program parametars table. Maybe your hw is limited…
yooyo[/b]
It sounds like it might be. 152 vec4s = 608 floats. The minimum legal value for GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB (according to page 194 of the Orange book) is 512 floats. Nvidia’s latest linux drivers have 256!
Originally posted by davej:
[b] [quote]Originally posted by yooyo:
[b]Can you tell us your hw and driver. If you have 38 matrices it uses 38*4 (=152) vec4 in program parametars table. Maybe your hw is limited…
yooyo[/b]
It sounds like it might be. 152 vec4s = 608 floats. The minimum legal value for GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB (according to page 194 of the Orange book) is 512 floats. Nvidia’s latest linux drivers have 256!
dave j[/b][/QUOTE]True, but there are a few other cards that don’t have that many uniforms but return a very high number which would mean software renderer.