PDA

View Full Version : order of translations/rotations



mikethebike
02-06-2012, 05:51 AM
Hi
what am i doing wrong? I get effects like earth rotating around the sun etc. But of course the terrain should rotate around me.
Many thanks
Michael


glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glTranslatef(0, -30, -64);//??

glRotatef(GetDataf(phi), 0, 0, 1);
glRotatef(GetDataf(theta), -1, 0, 0);
glRotatef(GetDataf(psi), 0, 1, 0);

glTranslatef(0, 30, 64);//???
glScalef( 1, -0.5, 1 );//flip terrain
drawTerrain();

awhig
02-06-2012, 09:57 AM
So you want your object to rotate rather than revolve?

From your code I see, you are also changing your axis of rotation, in the three glRotatef calls.

mikethebike
02-07-2012, 12:37 AM
roll, pitch and heading of a 128x128 terrain relative to an airplane. Now first i need to put the pilot at the center.
Thanks