PDA

View Full Version : Rotate around a certain point!!!!



angeldarkholme
10-13-2005, 08:47 PM
Hi everybody!
Here's my problem:
I want to follow a circle around the origin and look always at the origin, using gluLookAt....
My code is this:

glMatrixMode(GL_PROJECTION);
theta+=10;
float xp=10*cos(theta);
float yp=0;
float zp=10*sin(theta);
float xd=-cos(theta);
float yd=0;
float zd=-sin(theta);
float xu=0;
float yu=1;
float zu=0;
gluLookAt(xp,yp,zp,xd,yd,zd,xu,yu,zu);

Now....

What can I do to keep my object in the center of the screen instead of moving it around???

I don't now why I move all the scene around instead of moving only the point of view!!

Any help will be very appreciated.

memfr0b
10-14-2005, 12:47 PM
You could *not* move the center point of your lookat matrix around:


gluLookAt(
cam_x, cam_y, cam_z,
0, 0, 0,
0, 1, 0
);The second set of parameters (your xd, yd and yz) are a point in space, not a direction.