PDA

View Full Version : ROTATION



08-19-2000, 10:17 PM
Hi
Im trying to rotate an object around a cameras X and Y coords.I can get it to work for Y with the code below,but not X and Y together.

glPushMatrix();
glTranslatef(shipx, -shipy, -shipz);
glCallList(ship);
glPopMatrix();

deltaz = (float)(cos(DEGTORAD(camry)))*20;
deltax = (float)(sin(DEGTORAD(camry)))*20;
shipz = deltaz-camz;
shipx = deltax-camx;

Can anyone show me the formula to achieve this.
Thanks for any help.

DPalomo
08-20-2000, 09:26 PM
You could try to use the glRotate() function to rotate anything you want http://www.opengl.org/discussion_boards/ubb/smile.gif

Hope this helps,

Daniel Palomo van Es

08-20-2000, 10:37 PM
If I use the code below to rotate a sphere
10 units from 0,0,0 around the X or Y coords
is there a way to retrieve the spheres true
X,Z and Y coords.

glRotatef(roty,0,1,0);
glRotatef(rotx,1,0,0);
glTranslatef(0,0,10);

BJ.