OGL camera hell

This is the most frustrating thing I’ve encountered with OpenGL. Camera control in OGL is totally unintuitive. “Camera is always at 0,0,0 looking down negative Z-axis” Who thought up that?

If anyone has a short demo with source about moving/rotating the “camera” around could you link me? I’m getting really disenchanted with OGL’s camera system. I’ve looked at dozens of code samples and most people wimp out and use gluLookAt().

Everytime I try to rotate the camera around I get just the world rotating at the distinct axis X, Y, or Z.

What I would LOVE to be able to do is take a quaternion as my orientation and set the camera too it. I’ve tried taking a quaternion and inverting it, but that didn’t get the right rotations.

If I can’t get that I would love to be able to specify an Right, Up, Forward set of vectors that represent the camera.

This is unbelievably frustrating. I can make all my models rotate PERFECTLY, dance, and sing–via quaternion rotations, but when it comes to moving the camera around its like trying to orient a drunken sumo.

I’d really love any help, thanks!

Drunken Sumo… LMAO @ JunkStyle…

What is so wrong with gluLookAt();
I use it and it works well so far…
I rotate it and move forward and backwards, I could add a line of code to strafe, but I am not interested in doing it right now…

I just uploaded an example on frustum culling that implements a camera with 6 degrees of freedom with quaternions…
It is the third link on the right side… http://141.217.220.20/miguel/

I hope it helps…

[This message has been edited by mancha (edited 07-25-2002).]

Thanks Manchu, I saw your terrain demo…pretty smooth, about 200+ fps here.

That other demo got me going for my problem. I was actually doing the right thing but lack of confidence and stupid errors were screwing with my head…2 days down the drain.

He had:
GLvoid CAMERA::Apply()
{
Matrix.QuatToMatrix(Orientation);
Matrix.MatrixInverse();
glLoadMatrixf(Matrix.Element);
glTranslatef(-Position.x,-Position.y,-Position.z);
}

I do pretty much the same thing but slightly different:

  1. invert my quaternion (easy since its a unit quaternion)

  2. make rotation matrix with inverted quaternion and multiply it in with the stack

  3. do translation -x, -y, -z

She’s dancing like a ballerina now.

Glad I helped…

Thanx for the comment on the terrain…

I am working right now on a sky dome to add it to the terrain; it looks really nice… I will be making some tutorials too for the complete terrain set when I get it all done… I am pretty excited about it…

I would like to take a look at your stuff sometime if you dont mind… I like seeing what other people do…

yeah you, ioquan, and a bunch of others are going to get beta versions of my game + source as soon as I make it into a game. Right now its a foggy white coordinate system and a 4 triangle shaped spaceship. I’m working on the camera tracking system, which is going to be pretty weird—I hope. These last 2 weeks have been pretty intense: introduction to quaternions and OGL camera tracking. But the pain and suffering are well worth it. You don’t know how great it felt when I implimented simple thruster physics to my space ship and flew it around for the first time.

Originally posted by Junkstyle:
[b]This is the most frustrating thing I’ve encountered with OpenGL. Camera control in OGL is totally unintuitive. “Camera is always at 0,0,0 looking down negative Z-axis” Who thought up that?

If anyone has a short demo with source about moving/rotating the “camera” around could you link me? I’m getting really disenchanted with OGL’s camera system. I’ve looked at dozens of code samples and most people wimp out and use gluLookAt().

Everytime I try to rotate the camera around I get just the world rotating at the distinct axis X, Y, or Z.

What I would LOVE to be able to do is take a quaternion as my orientation and set the camera too it. I’ve tried taking a quaternion and inverting it, but that didn’t get the right rotations.

If I can’t get that I would love to be able to specify an Right, Up, Forward set of vectors that represent the camera.

This is unbelievably frustrating. I can make all my models rotate PERFECTLY, dance, and sing–via quaternion rotations, but when it comes to moving the camera around its like trying to orient a drunken sumo.

I’d really love any help, thanks![/b]

camera control in OGL is intuitive. learn matrix math well .

it’s not so hard. there’re camera tutorials at gametutorials.com, look into the one with a mouse on it, work on it, and you have a camera system that could move to whatever direction you want your world to be.

Originally posted by Junkstyle:
This is the most frustrating thing I’ve encountered with OpenGL. Camera control in OGL is totally unintuitive. “Camera is always at 0,0,0 looking down negative Z-axis” Who thought up that?

One of the keys to OpenGL enlightenment is undertanding that OpenGL does not have a “camera system”.

If you want a camera system in OpenGL, you have to create it yourself (or use someone else’s).

There is no spoon.
(but the little boy in the Matrix didn’t have to invert a quaternion to make it bend)

Nomad, the gametutorials.com samples all use gluLookAt().

[This message has been edited by Junkstyle (edited 07-23-2002).]

OGL camera style IS intuitive.
Think of the Camera as your screen. The modelview matrixes leed from it to the objects.

In your object hierarchy, lets say you have a matrix that is your camera. Absolute this matrix if its relative to another repere(s), then put the transposed matrix of this camera at the bottom of the modelview stacks (in the bottom = the first matrix that you push)

Whats so terrific about it ?
Oh, and lets stop afraid each other with such alien things as quaternions :slight_smile:

Just use glrotated(angle,x,y,z) to rotate the camera and gltranslated(x,y,z) to move the camera

I am with those who say that camera control is intuitive in opengl. :slight_smile: All you have to get over is that there is no camera! Just have to get the effect by altering the modelview matrix. Btw, D3D has a separate camera matrix which is nice. You don’t have to use it though. You can still mimic a camera al la opengl.

Kevin

Why don’t you guys all pat yourselves on the back already okay?