Results 1 to 4 of 4

Thread: Rotation

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    USA
    Posts
    7

    Rotation

    Hi All,

    I have a question regarding the rotation in
    opengl,I am trying to rotate the sphere either vertically or horizontally from any position,but when I rotate it horizontally by
    some angle say 45 degree and then try to rotate it vertically,it seems like slipping along some axes.I am interested in only vertical and horizontal rotation from any current position.

    Any suggestion??

    Many thanks
    Dev

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    352

    Re: Rotation

    Are you sure that you apply glTranslate and glRotate in correct order ? If you send your rendering code, we can check that.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    USA
    Posts
    7

    Re: Rotation

    Many thanks.

    I tried using this,
    But it is not working.
    glTranslatef(0,0,Z);
    glRotatef(Za,0,0,1);
    glTranslatef(0,0,-Z);

  4. #4
    Member Contributor
    Join Date
    Nov 2000
    Location
    Lyon, France
    Posts
    70

    Re: Rotation

    Hi,
    I think I have what you need : in my engine, I have a rotation system to optain a Roll/Yaw/Pitch for hirarchical z,y,x axis(like a plane).

    glLoadIdentity();
    glTranslatef (x_pos,y_pos,z_pos);
    glRotatef (y_yaw,0, 2, 0);
    glRotatef (x_pitch,1, 0, 0);
    glRotatef (z_roll,0, 0, 3);
    glScalef (x_scale,y_scale,z_scale);

    So, this might perform what you need : you can define all 3 axes like if they're hirarchical, and scale is all time local.

    Regards,

    Gaby

Similar Threads

  1. Rotation of an object by rotation matrix
    By MrFoil in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-02-2015, 04:41 PM
  2. Matrix Rotation loses 1 axes of rotation
    By Benzino in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-15-2011, 06:53 AM
  3. Replies: 1
    Last Post: 04-16-2010, 02:59 PM
  4. changing axis of rotation and center of rotation in openGL performer
    By ravishashi in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-08-2003, 04:42 AM
  5. world rotation v. body rotation
    By cosmicGirl in forum OpenGL: Basic Coding
    Replies: 31
    Last Post: 03-11-2003, 12:10 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