View Full Version : Kinda difficult to rotate
I'm trying to create a 90deg bend using glRotate and gluDisk. I'm rotating the plane about x-axis. The problem is, the disk is rotated about it's centre(centre of the disk is x=0). But I want to rotate the plane parallel to X-axis.
How to achieve this?
Source code follows
for (theta=0; theta<=20; theta=theta+0.5)
Thanks in advance
04-13-2002, 01:07 PM
glRotatef(90.0, 1.0, 0.0, 0.0); or
glRotatef(90.0, 0.0, 1.0, 0.0); or
glRotatef(90.0, 0.0, 0.0, 1.0);
Did you try those?
>glRotatef(90.0, 1.0, 0.0, 0.0); or
>glRotatef(90.0, 0.0, 1.0, 0.0); or
>glRotatef(90.0, 0.0, 0.0, 1.0);
>Did you try those?
All the above rotates the disk about it's centre. But I want to rotate the disk about a point which is on the cricumference of the disk
First transate the disk so the point of rotation is located at the origin, then rotate, then translate back. If the point of rotation is (x, y, z), you should do something like this.
glTranslate(x, y, z);
glTranslate(-x, -y, -z);
I guess it's like this. I'm rotating the drawing plane and then drawing the disk. gluDisk takes the origin from the current matrix(i think). I have given the code in my first posting. Hope it will throw some light.
04-15-2002, 05:30 AM
Bob's suggestion should work. Basically, you need to translate so that the point you want to rotate around is at 0,0,0, then rotate, then undo the translation you did. Keeping in mind that when you think it terms of world coordinates, what you do last is applied first. (i.e. glTranslate();glRotate(); // glRotate is applied first)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.