I have a question about glNormalMatrix. what is the purpose of this function? why couldn’t one just use glModelView since the normal is defined in object space just like vertices?

I searched for this answer on the web and on this site and I couldn’t turn up anything. Whats the difference between normalMatrix, and modelView matrix?

gl_NormalMatrix is not a function but a built-in uniform. It’s the inverse transpose of the upper left 3x3 part of the model-view matrix.

Normals are direction vectors that need to remain perpendicular to the surface after the transformation, unlike the position vectors of a model. It turns out that the inverse transpose of the 3x3 part does exactly that.

Note that as long as you’re only using rotation and translation, gl_NormalMatrix is indeed identical to the upper left 3x3 part of gl_ModelViewMatrix.