PDA

View Full Version : [glm] Best way to zero out translation component



OptimisticMonkey
08-18-2011, 08:21 PM
What is the easiest way to zero out the translation component of a glm::mat4....


Thanks for any advice

Alfonse Reinheart
08-18-2011, 08:30 PM
It's the fourth column.

OptimisticMonkey
08-18-2011, 08:40 PM
Thanks Alfonse

So should this work:

glm::mat4 no_translation = view_matrix;
no_translation[3].x=0;
no_translation[3].y=0;
no_translation[3].z=0;
no_translation[3].w=0;

Groovounet
08-19-2011, 02:33 AM
Actually:
no_translation[3] = glm::vec4(0, 0, 0, 1);

Or using the component names if you want.