PDA

View Full Version : Need help with rotation!



demonsa
04-06-2004, 01:53 AM
I need to rotate a planet which I had made around a sun, but i would have to rotate it around the x-y axis and I have to rotate it such that it is an ellipse (oval shape) eg 100 units in x, 200 units in y. I tried using glrotate but to no avail...

mikael_aronsson
04-06-2004, 02:05 AM
Hi !

You can use glScale to change the rotation into an ellipse (like glScale3f( 1.0, 2.0, 1.0) ;)

Just make sure you put them in the correct order.

Mikael

04-06-2004, 07:35 AM
Sorry but I do not understand how to use it,cost if you use glscale, would it not just affect the size of my planet? my code goes something like this:
glPushMatrix();

// Planet has a height of 3.8, need 3.95 times to be of size 15
glScalef(3.95, 3.95, 3.95);

// Make the planet spin in oval shape
glRotatef(planetSpin, 0.0, 0.0, 1.0);

// Move the planet
glTranslatef(15.0, 8.5, 0.0);
glRotatef(planetRotate, 1.0, 0.0, 1.0);
make_planet();