Results 1 to 4 of 4

Thread: How do you rotate an individual object and not the whole scene?

  1. #1
    Member Contributor
    Join Date
    Mar 2000
    Posts
    94

    How do you rotate an individual object and not the whole scene?

    How do you rotate two objects independently? I have a 3d cube suspended above a floor. i want to rotate the cube and not the floor. I can't get all the pushMatrix popmatrix, Modelview stuff to work right.. Can someone tell me the the syntax for acheiving this effect? Thanks again!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: How do you rotate an individual object and not the whole scene?

    //preparation before rendering

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //Set the view frustum(glfrustum or gluProjections
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity()

    //Set the camera position

    glPushMatrix();

    //transformations
    //Draw the floor

    glPopMatrix();

    glPushMatrix();

    //transformations
    // draw cube

    glPopMatrix();

    don't forget, if you want to rotate and oject around it's center you need to put the glRotate before the glTranslate


    [This message has been edited by Gorg (edited 04-04-2000).]

  3. #3
    Member Contributor
    Join Date
    Mar 2000
    Posts
    94

    Re: How do you rotate an individual object and not the whole scene?

    Originally posted by Gorg:
    //preparation before rendering

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //Set the view frustum(glfrustum or gluProjections
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity()


    I'm not sure I understand. What does translation have to do with my rotation?

    //Set the camera position

    glPushMatrix();

    //transformations
    //Draw the floor

    glPopMatrix();

    glPushMatrix();

    //transformations
    // draw cube

    glPopMatrix();

    don't forget, if you want to rotate and oject around it's center you need to put the glRotate before the glTranslate


    [This message has been edited by Gorg (edited 04-04-2000).]

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: How do you rotate an individual object and not the whole scene?

    If you don't need to use translations, then don't use them.

Similar Threads

  1. Rotate scene
    By Mukund in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-30-2010, 01:19 PM
  2. Rotate camera around scene or the likes
    By truetaurus in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-25-2009, 07:49 AM
  3. How to rotate a single object and not the scene?
    By mobilevisuals in forum OpenGL ES
    Replies: 1
    Last Post: 10-02-2009, 03:59 PM
  4. How to rotate an entire scene?
    By Eymerich in forum OpenGL ES
    Replies: 3
    Last Post: 01-09-2008, 03:57 AM
  5. How to rotate a view point in the scene ?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-14-2001, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean