PDA

View Full Version : uniform variables in vertex and fragment shader



powerpad
06-14-2005, 07:12 AM
If I declare a uniform variable within a vertex shader and a fragment shader and assign some value to that uniform variable, will this value be visible in my fragment shader.

Because I want to compute something but do not look for interpolation which is done with varying variables.

Mazy
06-14-2005, 07:17 AM
Have you thought about how that should work?
if you assign different values for different vertices, on which fragment should you use the first or second value? if you assign the same value for all vertices then this is not a problem.

powerpad
06-14-2005, 07:57 AM
thanks,

I thought about what I want to do (or will)
and it seems nonsense what I first thought.

Relic
06-14-2005, 10:37 PM
Originally posted by Mazy:
Have you thought about how that should work?
if you assign different values for different vertices, on which fragment should you use the first or second value? if you assign the same value for all vertices then this is not a problem.You mixed vertex attributes with program uniforms.
powerpad, it's perfectly ok to have the same uniform in a vertex and in a fragment program. If you set it, the value will be constant for both pipelines during the runtime of that program.