Search code examples
openglmatrixglslprojectionvertex

About OpenGL Matrix Multiplications


http://www.cs.uaf.edu/2007/spring/cs481/lecture/01_23_matrices.html

I have just finished reading this, but i have 2 questions about multiplications.

gl_Position = gl_ProjectionMatrix*gl_ModelViewMatrix*gl_Vertex

This is the final screen coordinates (x,y) when i multiply them all. What if i only multiply gl_ModelViewMatrix*gl_Vertex or gl_ProjectionMatrix*gl_Vertex ? And what does gl_Vertex mean alone ?


Solution

  • What if i only multiply gl_ModelViewMatrix*gl_Vertex or gl_ProjectionMatrix*gl_Vertex ?

    Then the projection matrix (the 1st case) or model-view matrix (the 2nd case) will not take effect. If they are identity matrices, you will not see effect. If they are not, then your view angle or position might be wrong.

    And what does gl_Vertex mean alone ?

    gl_Vertex is the vertex coordinate that is passed to the input of the pipeline.