Schnulla

06-01-2010, 07:22 PM

Hey,

I managed to use this nice GLM library to replace glOrtho(),

gluPerspective() and gluLookAt() to create the matrices for

the deprecated shader uniforms gl_*Matrix.

What's left is to create gl_NormalMatrix.

I already know it must be the transpose of the inverse

of the upper left 3x3 part of the gl_ModelViewMatrix.

So this is my code:

gl_NormalMatrix= glm::transpose(glm::inverse(glm::mat3(gl_ModelView Matrix)));

Is this correct? Anyone already tried to create a

gl_NormalMatrix using GLM and can confirm that

this code should do the trick? :)

Thanks!

I managed to use this nice GLM library to replace glOrtho(),

gluPerspective() and gluLookAt() to create the matrices for

the deprecated shader uniforms gl_*Matrix.

What's left is to create gl_NormalMatrix.

I already know it must be the transpose of the inverse

of the upper left 3x3 part of the gl_ModelViewMatrix.

So this is my code:

gl_NormalMatrix= glm::transpose(glm::inverse(glm::mat3(gl_ModelView Matrix)));

Is this correct? Anyone already tried to create a

gl_NormalMatrix using GLM and can confirm that

this code should do the trick? :)

Thanks!