PDA

View Full Version : Uniform variables not listed when glGetActiveUniform is called



CelticDaddio
02-07-2006, 07:07 AM
OS: Mandrake Linux 10.1 Official
GL_RENDERER: Quadro FX 4400/PCI/SSE2
GL_VERSION: 2.0.1 NVIDIA 81.78
GL_VENDOR: NVIDIA Corporation

I am having a problem with uniform variables. I can't seem to get some of my uniform variables to be seen as active. I have a sampler2D in my frag shader, which is listed in the list of active uniforms when I call glGetActiveUniform. However when I add another uniform to the frag shader, for example



uniform vec3 SourceDirection;this uniform is not listed in the list of active uniforms. I am using SourceDirection, so it should be active correct?

Any ideas?

Thanks,
CD

Relic
02-07-2006, 07:57 AM
You say you used it, but was it really needed? ;)
Post the whole vertex and fragment shaders.

CelticDaddio
02-07-2006, 09:00 AM
Yes I need it... wouldn't be trying to get the variable working if not... When I say I "used" it, I simply added something like:


vec3 temp = SourceDirection;in an attempt to force it to be seen as active....

Can't post the entire shader code... proprietary algorithms in them....

CD

Relic
02-07-2006, 09:18 AM
When I say I "used" it, I simply added something like:
vec3 temp = SourceDirection;
in an attempt to force it to be seen as active....
That's not what I meant with "needed".
Any uniform or attribute which does not contribute anything to the final output can be eliminated by compilers.
If you added gl_FragColor = vec4(SourceDirection, 1.0);
in an executed branch, then that's what I call needed.

CelticDaddio
02-07-2006, 10:18 AM
Sorry... didn't mean to come across as a smart-alec...

It appears my understanding of an active variable is in complete... From what you said "Any uniform or attribute which does not contribute anything to the final output can be eliminated by compilers" seems to say that simply "using" the variable in the body of the shader isn't enough, but that it actually has to be something that is used to generate the final output... Is that correct?

Thanks,
CD


Originally posted by Relic:

When I say I "used" it, I simply added something like:
vec3 temp = SourceDirection;
in an attempt to force it to be seen as active....
That's not what I meant with "needed".
Any uniform or attribute which does not contribute anything to the final output can be eliminated by compilers.
If you added gl_FragColor = vec4(SourceDirection, 1.0);
in an executed branch, then that's what I call needed.

CelticDaddio
02-07-2006, 10:28 AM
Originally posted by Relic:

Any uniform or attribute which does not contribute anything to the final output can be eliminated by compilers.

If you added gl_FragColor = vec4(SourceDirection, 1.0);
in an executed branch, then that's what I call needed.
That was the problem.... Thanks,

CD