I am trying to make a FPS camera class that works well with Irrlicht and uses a ton of OGL4.0 calls using shaders. The class is based off Quaternion rotation and I simple transform the normalized view direction by the axis and angle.
I got it working except for one thing that I can't understand.
When I rotate my camera the scene rotates instead of rotating the "camera" around its axis. I basically am orbiting my scene instead of looking around in the scene.
Technically, it shouldn't be doing this.
In my vertex shader, I am using three matrices for the MVP matrix example.. (new_coords = P*V*M*coords;)
This shouldn't cause any problem. I use my own implementation of GLuLookat which combines a rotation and translation together. (V = R*T) (R is the Glulookat Matrix and translation is the transformation(-eye))
M is IDENTITY and P is the generic Projection matrix.
My googling says that in order to rotate a scene as I have described you must...
Translate(-eye)
Rotate
Translate(eye)
I am only doing one translation. Does anyone have any idea where I am making a fault?
Sincerely,
Alpha
OpenGL FPS Camera
-
- Posts: 288
- Joined: Wed Oct 29, 2008 12:07 pm
Re: OpenGL FPS Camera
Lesson learned: always make sure your matrix methods use column major multiplication for OpenGL . That took too much time to find .