PDA

View Full Version : Is gl_Vertex exactly the value transferred from glVertex3f?



zzzhhh
05-01-2017, 01:46 AM
Suppose I am using glVertex3f to transfer vertex position while at the same time using glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(...); to set up the model-view transformation. Is the gl_Vertex in the vertex shader the value I transferred in glVertex3f, not the value multiplied by the model-view matrix? Thanks a lot. PS: I know it is legacy OpenGL; I just have question on this specific point.

Add one more question: What about gl_LightSource[i].position? Is it affected by model-view matrix in vertex and fragment shaders? Thanks a lot.

Dark Photon
05-01-2017, 07:01 AM
Is the gl_Vertex in the vertex shader the value I transferred in glVertex3f, not the value multiplied by the model-view matrix?

Right.


Add one more question: What about gl_LightSource[i].position? Is it affected by model-view matrix in vertex and fragment shaders? Thanks a lot.

It's the position you specified on the C/C++ side transformed by the MODELVIEW setting in effect when you set that position. In other words, it's already in EYE space when you get the value in the shader.

zzzhhh
05-01-2017, 12:27 PM
I got it. Thank you very much, Dark.