Here's my code .. But my sphere always stays at the origin... my glTranslatef() doesn't change the position of the sphere... Give me answers with explanation..
glColor3f(1,0,0);
GLUquadric *quad;
quad = gluNewQuadric();
gluSphere(quad,25,100,20);
glTranslatef(2,2,2);
You're drawing the sphere before doing the translation, so of course the translation has no effect.
Move your glTranslatef
to above gluSphere
glColor3f(1,0,0);
GLUquadric *quad;
quad = gluNewQuadric();
glTranslatef(2,2,2);
gluSphere(quad,25,100,20);
(Also note that the glu
library is a quite old, and you should probably avoid it)