Opengl rotating shapes
Posted on 2011-03-20
I am trying to rotate shapes in opengl. But I want to rotate them on there position so that they just look like they are spinning instead of rotating around a point.
At the moment this is how I am doing it.
static int weaponangle = 0;
then in the display function
glTranslatef (-1.0, 0.0, 0.0);
glRotatef ((GLfloat) weaponangle, 1.0, 0.0, 0.0);
// glTranslatef (1.0, 0.0, 0.0);
//glScalef (2.0, 0.4, 1.0);
weapon is a sphere that I want to spin around. I am using user input like below
weaponangle = (weaponangle + 10) % 360;
frame = 0;
bWeaponIsActive = true;