Results 1 to 2 of 2

Thread: glutMouseFunc() how do you know where your objects are located

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Virginia
    Posts
    1

    glutMouseFunc() how do you know where your objects are located

    hey,

    I am just starting to use OpenGL and I am trying to click on a triangle and move it around the screen.

    I think I have to use glutMouseFunc()

    but how do you know where the triangles are, you can't pass the coordinates into the function.

    I could use global, but from all my C++ classes we learned that global=bad... so what is the best way to go about doing this.

  2. #2
    Guest

    Re: glutMouseFunc() how do you know where your objects are located

    hey thor, welcome to the wonderful world of design decisions

    a common approach is to keep geometry in some kind of world/level object. that way, to query the location of a particular object, you can ask the world where it is. the world can then do a line trace, or employ some other technique to determine the object's location at the mouse xy.

    you might also look into the gluUnProject function. it takes points from screen-space back into world-space (handy info for line traces).

    also, some clever use of gl picking can produce very good results. it all depends on what you're after.

Similar Threads

  1. The procedure entry point could not be located
    By AndyYin in forum OpenGL: Windows
    Replies: 2
    Last Post: 05-30-2009, 06:43 PM
  2. glutMouseFunc
    By vivek vyas in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-26-2009, 01:26 AM
  3. Replies: 2
    Last Post: 01-24-2002, 01:32 PM
  4. OpenGL Lighting: Dynamically Located Lights
    By s_fonden in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 04-18-2001, 02:21 PM
  5. which side of a plane is a vertex located?
    By tango in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 01-30-2001, 10:08 AM

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