Uniform variables in vertex and fragment shader

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.

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.

thanks,

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

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.