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

Thread: Center on point

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2004
    Location
    Quebec, Canada
    Posts
    2

    Center on point

    Hi,

    I have an OpenGL view, and I want to center the view
    on point where the user click.

    Example :

    If I click on Point(50,50) -> I want to center on point(50,50).

    Someone can help me ?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Center on point

    Hi !

    It's not that simple, if you are using 2D only it's no big geal, but in 3D, what are you clicking on ? the X,Y coordinates for the point depends on the depth.

    So normally you need "something" to click on so you can get a depth value (have a look at gluProject and gluUnProject).

    Mikael

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2004
    Location
    Quebec, Canada
    Posts
    2

    Re: Center on point

    I have an object for clicking on it.

    I use both 2D and 3D.

    I use "gluUnProject" for obtain my position when
    I click.

    But if I set the Pan with the position, it don't
    center correctly my object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •