glm toolkit - matrix decompose

I am a glm noob…

I am trying to get a normal matrix from my modelview matrix for lighting.

Right now I am using glm::inverseTranspose and it works.

Would it be more efficient to just apply the rotation part for the model view matrix, since I am only using rotation, translation, and uniform scaling?

Is there a faster function in glm to decompose the model viewmatrix into the rotation part?

Thanks for any advice / feedback

Would it be more efficient to just apply the rotation part for the model view matrix, since I am only using rotation, translation, and uniform scaling?

Yes. Though you should note that you’re doing it for future reference, just in case you start using a non-uniform scale.

Is there a faster function in glm to decompose the model viewmatrix into the rotation part?

You can pull the 3x3 matrix from a 4x4 matrix with the 3x3 matrix’s constructor. Just like the GLSL spec says you can.

Thanks Alfonse - That was exactly what I was looking for :slight_smile: