Results 1 to 4 of 4

Thread: rotate for a point in plan

  1. #1
    Guest

    rotate for a point in plan

    HI,
    I'm working on an RTS 3D engine, and i've a lot of problems with rotations.

    I want to rotate (with the mousewheel) the view, not at the windows center, but at a pixel of the screen( the one under mouse for exemple).
    The code is not hard :
    - glTranslatef( ix, iy );
    - glRotatef( angle, 0, 0, 1);
    - glTranslatef( -ix, -iy );

    where ix and iy are world coordinates of the pixel under the mouse.
    It works fine.
    But I want the center of rotation to change ( where my mouse is)
    So when I change the mouse position and start to turn wheel, the plan rotate for the good world coordinate point, but it doesn't correspond to my mouse location. It's due to the formules, I know, but i don't know how to achive that.
    Maybe there is a fonction to force one world point to draw on one screen pixel (xith a translation probably).
    If anybody can help me....
    Thanks and sorry for my poor english

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    23

    Re: rotate for a point in plan

    are you using gluUnProject to transform window coordinates to world coordinates?

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    23

    Re: rotate for a point in plan

    are you using gluUnProject to transform window coordinates to world coordinates?

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    23

    Re: rotate for a point in plan

    are you using gluUnProject to transform window coordinates to world coordinates?

Similar Threads

  1. Rotate an object around a point
    By coolbiscuit in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-02-2018, 05:23 AM
  2. rotate around arbitrary point
    By thinhare in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-03-2010, 03:24 PM
  3. Rotate around a certain point!!!!
    By angeldarkholme in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-14-2005, 05:51 PM
  4. Rotate around a certain point!!!!
    By angeldarkholme in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-14-2005, 01:47 PM
  5. Rotate vector around point?
    By Caesar in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-22-2000, 05:45 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
  •  
Proudly hosted by Digital Ocean