I’m sure you’ve spotted the error: there’s no such thing as gl_ColorSoFar! I have no idea what to put there. I know that in the previous stage of the FFP, the vertex shader spits out some color, how do I grab it and continue with it?
Hi,
I can give u two solutions for this, the first is the answer (using FFP) and the second is what u should use now (modern opengl 3.0 and above GLSL version 330). Old GLSL version using FFP
The per vertex color attribute comes in gl_Color register in the fragment shader if you assign to gl_FrontColor in the vertex shader. Add this to your vertex shader.
So it used to be that glVertex() would assign a value to gl_FragCoord, but now we have to make our own function to use instead, that will bind a position to vVertex?
So it used to be that glVertex() would assign a value to gl_FragCoord
Not directly. glVertex() would be transformed by the current matrices into a clip-space value, which then would be processed by the OpenGL hardware into a window-space coordinate. The interpolation of that coordinate over a triangle’s face would result in gl_FragCoord for a particular fragment.