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: Restoring a vector after multiplying it by a matrix

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2015
    Posts
    7

    Restoring a vector after multiplying it by a matrix

    Hello, normally I wouldn't post but I really can't find a clear answer anywhere on the internet. Basically I got a vector, then multiply it by a matrix and then I want to do something some action to restore it back to the way it was. It looks something like this.

    glm::vec4 b = transform.GetMVP(camera) * glm::vec4(model.positions[i], 1.0);
    b.x = mx * b.w;
    b.y = my * b.w;
    glm::vec4 c = (some magic function that does opposite what multiplying by a matrix does) * b;

    //transform.GetMVP(camera) is the 4x4 matrix

    Solved the problem using glm:: project/Unproject. Feeling stupid now. Sorry for the thread.
    Last edited by gaubtas123; 07-07-2015 at 02:28 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
  •