Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 1 of 1

Thread: GLM Matrix Reuse

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    5

    GLM Matrix Reuse

    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
    Last edited by mynameisjohn; 05-24-2014 at 09:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •