I don't know what exactly you are trying to achieve here, but you might use some simple rounding behavior, or use an integer varying. However, you should never check floats for equality.
You should also take into account that the fragment might be even sampled outside of the primitive.
#Opengl 4.3 best ways to deal with vertex data code
But it is unclear that your code guarantees that. If all fragment shader invocations actaully get the same value for that varying, it would be allowed, I guess. When functions are involved, this refers to calls from the same call This refers to the expression's value for the same loop iteration. With dynamically uniform being defined as follows:Ī fragment-shader expression is dynamically uniform if all fragmentsĮvaluating it get the same resulting value. ) can only be indexed with a dynamically uniform integralĮxpression, otherwise results are undefined. In OpenGL 1.5, Vertex Buffer Objects (VBOs) were added, allowing vertex data to be uploaded to the OpenGL implementation and then possibly discarded from the programs memory space. The GLSL 4.00 specification states now the following (still my emphasis): The immediate mode model was also grossly inefficient in terms of how vertex data was actually specified: real. Using a varying as index to a texture does not represent a constant expression as defined by the spec.īeginning with GL 4.0, this was somewhat relaxed. ) can only be indexed with integral constant expressions (see
Samplers aggregated into arrays within a shader (using square brackets Let me quote the GLSL 3.30 specification, section 4.1.7 "Samplers" (emphasis mine): What you are doing here is invalid in OpenGL/GLSL 3.30.