Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 11

Thread: A simple Rotation problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie novice01's Avatar
    Join Date
    Jan 2013

    A simple Rotation problem


    I am new to OpenGL programming and this is my first post in the forum, so hello everyone.

    I have been having this problem with this successive translation and rotation thing. Suppose I want to move a cube 5 units down the +x axis and then rotate this 45 degrees about the initial origin. So the cube would be midway between x and y axis. But the code snippet I am writing in a display function is able to translate it 5 units but the rotation is about the cube's coordinate system so the cube remains in the x -axis only. Where could I be going wrong?

    gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
    glTranslatef(5.0, 0.0, 0.0);
    glRotatef (45.0, 0.0, 0.0, 1.0);
    glutWireCube (1.0);

    Please let me know if the question is unclear.
    Last edited by novice01; 01-05-2013 at 05:51 AM.

Posting Permissions

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