Thread: OpenGL Rotation

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    11

    Smile OpenGL Rotation

    hi alll!!
    I need to rotate a 3D object about its origin..This topic was already discussed earlier.. Anyways Its just the continuation of this thread..
    http://cboard.cprogramming.com/archi...p/t-61196.html

    Can the same person(Darkness) elaborate on this..

  2. #2
    Registered User
    Join Date
    May 2008
    Posts
    11
    My problem statement: I am displaying a .wrl file successfully. Now i need to rotate on the screen based on mouse interaction. Now I am able to rotate that object with respect to screen's origin, i want the object to rotate with respect to its center point..

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    When you use matrices to rotate something, it is only possible to rotate about the origin. To rotate around the center, you need to move you mesh to the origin, then rotate it, and then move it back

  4. #4
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    I echo what h3ro said.

    To really understand why it is this way, you need to take to learn linear algebra and then study matrix transformations in computer graphics. But the jist of it is: translate the object to the origin, rotate it, translate it back to its original position.
    My Website

    "Circular logic is good because it is."

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    11
    I know that actually.. The problem is i don't know how to move to origin for that object being displayed.. ??

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    11
    i hav provided options such as zoom in and zoom out. When i zoom out and rotate, rotation takes place but does not rotate within that object's center. It rotates with respect t sceen's center point so it takes a huge diameter...

  7. #7
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    is the object is at 10,10,10 then just move it -10,-10,-10, then rotate

  8. #8
    Registered User
    Join Date
    May 2008
    Posts
    11
    ok i wil try n let u know sooon..

  9. #9
    Registered User
    Join Date
    May 2008
    Posts
    11
    thanks guys.. It worked successfully..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL hue rotation
    By Blink in forum Game Programming
    Replies: 4
    Last Post: 08-14-2007, 03:42 PM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM