View Full Version : help me !!!!!

09-04-2001, 08:18 PM
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()

09-04-2001, 08:32 PM
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.


09-04-2001, 09:20 PM
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

09-04-2001, 10:30 PM
but in that pyramid several cubes are placed, glTranslatef() for each cube. to use glRotatef() what should be the position of glTranslatef.

09-05-2001, 08:00 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

09-05-2001, 08:11 AM
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.