help me !!!!!

i’ve created a 3d pyramid using display list. now i want to move camera to watch it in ariel view,such as watching pyramid from helicopter. what should i do ?. is it simple rotation using glRotatef()

if you just want to get a top view, just rotate your pyramid 90 degrees on the x axis

 (degree,  x,  y,  z)


not sure if -90 or 90, just try it.


Hi you to rotate your pyramide !!!

define a rotate Variable like rot
for example:
static GLfloat rot = 0.0f;

go to your Draw Routine and write
glRotatef(Rotate, 1.0f, 0.0f, 0.0f);
Rot += 1.0f;
and now your object should rotate around the x-axis

I hope that solve your problem

c u

but in that pyramid several cubes are placed, glTranslatef() for each cube. to use glRotatef() what should be the position of glTranslatef.

if you mean you have cubes positioned inside the pyramid and you want the whole thing to rotate, then here is what you do:

glRotatef(rot++,1,0,0);// define rot as GLfloat

//do drawing here

your pyramid and cubes shold all rotate as one object. If you have glLoadIdentity in your drawing process, replace them with glPushMatrix and glPopMatrix like so:

glRotatef(rot++,1,0,0);// define rot as GLfloat
//draw pyramid

//draw cubes

lather rinse repeat

actually add a glTranslatef(); in the z direction into where your pyramid is going to appear right before the glRotatef() so that you are rotating the x axis near your pyramid.