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.
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.