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

Thread: translate?

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    translate?

    If I have a cube, and I want it to disappear if I click it with the mouse? How do I do? Is there any way to convert x, y cordinates to the float system that opengl uses?
    CyBBe

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    200

    Re: translate?

    Hi there!

    Well, you will find this topic covered under the title "picking" in the red book.

    (or search this forum for it )

    Hope that helped you!

    Regards,

    (and may the vector be with you)

    LG

  3. #3
    Intern Contributor
    Join Date
    Mar 2000
    Location
    PA, USA
    Posts
    74

    Re: translate?

    For translating the x,y coordinates into the "world" coordinates of OpenGL, use the gluProject and gluUnproject functions. The gluProject will take a world point and give you back the projection of it into the window coordinates. Note that the coordinate you get back will be 3D, not 2D as you might expect. The z component is the depth component and can be quite useful.

    The gluUnproject may be what your looking for. It takes a window point (again, this is a 3D point where the z component specifies the depth in window coordinates and the x and y are what you normally think of for window points) and transforms the window point into the corresponding world point.

    Selection is described fully in the OpenGL Redbook. If you are doing simple selection, look in the "Now that you know" section of the Redbook. It describes a very simple way to implement selection by drawing pointers (or some other identifiers to the back-buffer).

    Good luck.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    Re: translate?

    Thanx!
    CyBBe

Posting Permissions

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