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?
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.
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:
[b] [quote] 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.[/b][/QUOTE]