Hello you all.
You guys must know that the matrix stack isn’t avaliable anymore on the opengl 4.2 core profile. So, functions such as pushmatrix(), popmatrix() and etc. became deprecated.
I was working on chapter 4 of www.openglbook.com, and he suggests the reader to try to move the camera with the keyboard.
I found a way to do this putting back the view matrix on the origin, rotating it around the x and y axis, and then translating it again on the z axis.
How can I do this in a more complicated program, that I don’t know, for instance, where am I in relation to the origin?
Thank you.
How can I do this in a more complicated program, that I don’t know, for instance, where am I in relation to the origin?
Why don’t you know? The whole point of having world space is to have a neutral space in which all objects and the camera can be relative to. In order to be useful, you must therefore know the position and orientation of the camera in world space (ie: in relation to the origin).
Well, let’s suppose my keyboard is controlling the translation of the view matrix (not modelview, i’m using two different matrices for learning purposes). Do I need to keep track of every translation I’m doing to, for instance, rotate it and keep looking to the origin (To rotate and don’t change the viewpoint I need to rotate the identity view matrix)?
Because that was the solution I found, but it’s weird that you don’t have anything replacing the matrix stack…