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 4 of 4

Thread: Rotation around the center

Threaded View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    207

    Rotation around the center

    I have object moving from A to B on x-axis and there is no translation of object apart from it. Now, while moving, i want to rotate it around y-axis and the motion should change accordingly, i mean If it rotates 90 in clockwise while moving along +x axis, it should take a turn and move towards near plane along z axis. I have variable in gltranslatef which is modified in the loop after that i have glscalef to scale whole object which is made of hierarchical structure. Now i tried following code to achieve the expected result but its not working properly
    Code :
    	glTranslatef(move, 0, 0);
     
    	// If I comment these 3 lines, it does not affect the output
             glTranslatef(-move, 0, 0);
    	glRotatef(rotate,0,1,0);
    	glTranslatef(move, 0, 0);
     
    	glScalef(0.2, 0.2, 1.0);
    Last edited by debonair; 10-10-2013 at 11:22 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
  •