Results 1 to 4 of 4

Thread: Getting Where the Mouse Clicks in OpenGL?

  1. #1
    Join Date
    Dec 2011
    Beans
    48

    Getting Where the Mouse Clicks in OpenGL?

    Hello, I am making a OpenGL game in C++ and it relies on where the mouse clicks in the 3D space for movement, placing objects, and probably other stuff too. I can't seem to figure out how to do this though. How do I find the coordinates where a user clicks?

  2. #2
    Join Date
    May 2007
    Beans
    251

    Re: Getting Where the Mouse Clicks in OpenGL?

    Quote Originally Posted by theopfor View Post
    Hello, I am making a OpenGL game in C++ and it relies on where the mouse clicks in the 3D space for movement, placing objects, and probably other stuff too. I can't seem to figure out how to do this though. How do I find the coordinates where a user clicks?
    You could use glutMouseFunc() to set the callbacks.

    Here is a GLUT tutorial for mouse events:
    http://programming-technique.blogspo...use-click.html
    The Unforgiven

  3. #3
    Join Date
    Jul 2009
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Getting Where the Mouse Clicks in OpenGL?

    Keep in mind that opengl is only for the graphics, the windowing library you are using can provide you with information where your user clicks within your window. (but you'll probably end up with a 2D coordinate...)

    cheers
    Windows DOS not compute...

  4. #4
    Join Date
    Dec 2011
    Beans
    48

    Re: Getting Where the Mouse Clicks in OpenGL?

    Quote Originally Posted by the_unforgiven View Post
    You could use glutMouseFunc() to set the callbacks.

    Here is a GLUT tutorial for mouse events:
    http://programming-technique.blogspo...use-click.html
    I think that might be what I need, thanks!

Bookmarks

Posting Permissions

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