PDA

View Full Version : GLM Matrix Reuse



mynameisjohn
05-24-2014, 08:54 AM
Hey all, I sure hope this sub is active...

So I'm just learning about incorporating GLM into my code, and I was concerned about whether or not I was doing it correctly.

I'm writing a simple "game" wherein, during each render step, my player object is translated by some amount. I'm doing this by left multiplying my player's modelview matrix before sending it to the GPU using the following call:

myMV = glm::translate(glm::vec3(velX, velY, velZ)) * myMV;

What I think is happening is that, at every render call, I'm creating a new 4x4 matrix and doing a matrix multiply. This seems very expensive, so I was wondering if it would make more sense to simply edit the correct values of the MV matrix so that the translation occurs. However, I have no idea if that's what glm is really doing, so I was hoping to get some expert advice.

Thanks,

John