I’m studying Opengl and I could not understand how I cam manage a camera using matrix because it’s orientation.
For example, if I have 3 vectors representing local X, Y and Z axis of my camera and another vector representing my orientation. Initially, I have this vector like (0, 0, -1) witch is de default camera orientation.
When I set my camera I translate to my negative position and use glMultMatrix, using a matrix that I create with my localX, localY and localZ axis. So my question is: what for and how I can use my vector orientation to rotate my camera? I did not undertand how I can do this.
Any help will be appreciate.
Thanks a lot!
I advise you to use the gluLookAt() function to compute opengl matrices.
If you do this, you just have to know the camera and the target position and its orientation ( all is used by the last function).
Now, camera rotations and translations calulations remain… Maybe you can use spherical coordinates that are suitable. It is easy to calculate the target vector rotations using the camera center as the center of your spherical reference ( I don’t know if “reference” is the good word, but I don’t find the equivalent of “repère” in french, maybe someone knows…^^)
gluLookAt is the easiest way to do this, but in many game enigne, they wrote their class to keep these information.
In “OpenGL Distilled” this book section 3.3.2, it will teach you how to do manually use vector.