looking and moving around in GL_PROJECTION matrix mode

First off, I’m doing this in C++ and in gluPerspective, not Ortho.

ok, this is what I have.
My first problem is looking around, the axeses of rotaion aren’t right, but I can’t seem to figure it out. Here what I have:

glPushMatrix();
glRotatef(-yaw,0.0,1.0,0.0);
glRotatef(-pitch,1.0,0.0,0.0);
glRotatef(-roll,0.0,0.0,1.0);
glTranslatef(-eyeX,-eyeY,-eyeZ);
.
.
.

Can anybody help?

I’ll get to the next problem when this one is solved.

HI. Take a look at this page
http://www.lighthouse3d.com/opengl/glut/index.php3?6

Trust me; If you pay attention, it helps…

download the source and execute it to see it… its kinda cool

Thanks, but I’m trying to do this WITHOUT using the lookat command.

Can anyone help with the method I am using above?

[This message has been edited by drummerboy_2002 (edited 10-23-2001).]

> Thanks, but I’m trying to do this WITHOUT using the lookat command

why? do you want to do graphics without any gl commands, also?

cheers,
John

It was strongly suggested by my professor to NOT use LOOKAT. Instead, we use:

glRotate(-yaw…
glRotate(-pitch…
glRotate(-roll…
GlTrastlate(-eyeX, -eyeY, -eyeZ);

He has done a lot of work with flight simulators, so I assume there is a very good reason for it.

Your going to want to brush up on your geometry my friend. Especially if you plan on using JUST rotatef and translatef.

You want to translate according to the negative player.x, player.y, and player.z, and you want to rotate according to -player.rotation. You just need to do your rotations and translations in the right order. Rotate and then translate before drawing your scene.

Also, if you want the player to move foward relative to his rotation, you need to use some simple trig. In case you didn’t already know, that’s the following:

x += sin(angle) * speed;
y += cos(angle) * speed;

(you may need to switch the sine and cosine depending on how your coordinates are set up)

Also, remember that glRotate takes angles in degree measure, while sine and cosine take angles in radian measure, so you’ll need to convert between the two. Remember the following:

1 degree = PI/180 radians

A trick to compute PI quickly, easily, and painlessly, is the following:

PI = atan(1) * 4

“Also, remember that glRotate takes angles in degree measure, while sine and cosine take angles in radian measure, so you’ll need to convert between the two.”

Ah, maybe that’s what’s going wrong… hmmm. I’ll have to try that tomorrow. It’s getting too late to do it tonight.

We’ll see how things go.

EDIT hehe, goemetry is not a problem. Cal III, now that was a problem.

[This message has been edited by drummerboy_2002 (edited 10-23-2001).]

Also, you don’t change viewing direction in projection matrix mode, you do it in modelview. All this is covered very well in the FAQ.

“Also, you don’t change viewing direction in projection matrix mode, you do it in modelview”

Yeah, I know. I screwed up the topic title and couldn’t change it.

I CAN move and look around, but the axises of rotation aren’t quite right for the yaw, pitch and roll. That is what I’m am asking help on.

[This message has been edited by drummerboy_2002 (edited 10-25-2001).]