Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: help me !!!!!

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    mumbai, india
    Posts
    15

    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()
    we bring good programming to life......

  2. #2
    Guest

    Re: help me !!!!!

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

    (degree, x, y, z)
    glRotatef(90,1,0,0);

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

    Newbie

  3. #3
    Intern Newbie
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    47

    Re: help me !!!!!

    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

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    mumbai, india
    Posts
    15

    Re: help me !!!!!

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

  5. #5
    Guest

    Re: help me !!!!!

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

    glLoadIdentity();
    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:

    glLoadIdentity();
    glRotatef(rot++,1,0,0);// define rot as GLfloat
    //drawing
    glPushMatrix();
    //draw pyramid
    glPopMatrix();

    glPushMatrix;
    //draw cubes
    glPopMatrix();

    lather rinse repeat

  6. #6
    Guest

    Re: help me !!!!!

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •