Is there any way to pass a per-vertex attribute from a vertex shader to a fragment shader without that value being interpolated?
The situation I have is this: I need to specify the radius used by a vertex shader during the computation of the gl_PointSize on a per-particle basis. That shouldn’t be a problem because I can pass the appropriate value from the app to the vertex shader as a vertex attribute. The difficulty arises because I need to use that same radius for each fragment that is generated by the vertex so the fragment shader can do depth-correction. When I use a varying to pass the radius from the vertex shader to the fragment shader, weirdness ensues. This undoubtedly results from the perspective-correct interpolation performed on varying variables.
So, is there anyway around this issue, or is it going to be impossible to know what radius was used to generate the fragment? I’m open to anything that works, but something clean and fast would be preferable.