PDA

View Full Version : space ship



phil67rpg2012
10-15-2016, 08:44 PM
well I am trying to draw a space ship and have it move up and rotate around its origin and also have it follow its own nose. Basically I want it to move like in asteroids. I have almost figured out this problem. So far I moved the coordinate axis 5 units to the right and then rotates the ship and then moves the ship up. My problem is that now I want the ship to rotate around its own center or origin.

glPushMatrix();

glTranslatef(5.0f, 0.0f, 0.0f);

glRotatef(angle, 0.0f, 0.0f, 1.0f);

glTranslatef(0.0f, up, 0.0f);

draw_ship();

glPopMatrix();

Aleksandar
10-16-2016, 04:56 AM
I guess this (http://www.glprogramming.com/red/chapter03.html#name2) could help you to understand model-view transformations. :)