Hello,
can anyone tell me how to correctly pass (non interpolated) Integer values from the vertex shader to pixel shader? I want to pass absolute pixel coordinates to read from a Texture2d with texelfetch.
My best attempt so far was this:
Before the VS() I define the variable
out ivec2 vHexCoordinates;
And set the value inside VS(). I have tried it with something foolproof, setting it to constant values:
vHexCoordinates = ivec2(37, 23);
But for some reason inside PS() the value of this array is always (0, 0). I thought maybe I need to declare it as in instead of out for the pixel shader, but that is not possible because the declaration conflicts as both functions/declarations are in the same document.
Alternatively I have tried it with a flat float vector
flat out vec2 vHexCoordinates;
But here it gives me an error
*error C1311: qualifier "flat/smooth/noperspective" cannot apply to this type*
which is weird because I haven’t found any type to which I can apply flat and I don’t see why this shouldn’t be possible.
I would be thankful for any tips.