Results 1 to 4 of 4

Thread: translate?

  1. #1
    Senior 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
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    183

    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
    Member Contributor
    Join Date
    Mar 2000
    Location
    PA, USA
    Posts
    70

    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
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    Re: translate?

    Thanx!
    CyBBe

Similar Threads

  1. GLM::translate
    By OceanJeff40 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-14-2016, 04:11 PM
  2. Replies: 0
    Last Post: 03-19-2014, 10:11 PM
  3. can i translate
    By 6630 in forum OpenGL: Linux
    Replies: 1
    Last Post: 10-23-2007, 06:52 AM
  4. translate; scale; translate;
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-25-2004, 03:28 AM
  5. Represent Rotate and Translate by one Translate
    By Luin in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-02-2000, 01:54 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