Results 1 to 6 of 6

Thread: Kinda difficult to rotate

  1. #1
    Guest

    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)
    {
    glRotatef(0.5,1,0,0);
    gluDisk(quadric,0.8,1,32,32);
    }

    Thanks in advance

  2. #2
    V-man
    Guest

    Re: Kinda difficult to rotate

    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?

    V-man

  3. #3
    Guest

    Re: Kinda difficult to rotate

    >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

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Kinda difficult to rotate

    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.
    Code :
    glTranslate(x, y, z);
    glRotate(...);
    glTranslate(-x, -y, -z);

  5. #5
    Guest

    Re: Kinda difficult to rotate

    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.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Kinda difficult to rotate

    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)
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Normal question (well, kinda weird actualy)
    By c_olin in forum OpenGL: Basic Coding
    Replies: 33
    Last Post: 08-13-2003, 08:34 PM
  2. Terrain Textures... Kinda
    By zix99 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-13-2003, 10:50 AM
  3. Rotation quirks, etc... need help kinda quick
    By Doublearon in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-02-2002, 06:32 AM
  4. OT kinda.. Normal code
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 02-08-2002, 06:31 AM
  5. Replies: 6
    Last Post: 10-09-2000, 09:57 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
  •  
Proudly hosted by Digital Ocean