Object movement

How do move an object’s xyz axis’ in opengl? Or how can I move the object forward and backward? Am I being too vague in my questions? Thanks…

glTranslated(x,y,z) if your values are doubles or glTranslatef(x,y,z) if your values are floats.

Is my answer precise enought ? Thanks… :stuck_out_tongue:

here’s one way:

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
//now you perform your transforms

glTranslatef(deltaX,deltaY,deltaZ);
glRotatef(theta,x,y,z);
glScalef(xScale,yScale,zScale);

//Render your object

glPopMatrix(); //restore modelview matrix

Thanks… How could I get a camera to follow it? Thanks again…

I think When you move the object, the camera’s position doesn’t change. It’s decided by the parameters of gluLookAt.

Could I make it change according to the objects position?