Thread: opengl question. mouse location vs gluperspective

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    221

    opengl question. mouse location vs gluperspective

    curently, my viewport is set to the max scren resolution (1024x768)
    i have a mouse function that takes the coords of a mouse and uses that as the center to draw a square (mock paddle)

    the problem is that, now what im using gluperspective and not glortho, a little mouse movement will send the paddle flying of to the side. back when i used glortho, the mouse was perfectly centerd on the paddle each time. how can i go back to that using gluperspective?

    thanks

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Try using gluProject to project your 2d mouse point to the window coordinate system. Then you will know the corresponding location you should draw your paddle at. Hope this helps.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mouse Train in OpenGL
    By Ti22 in forum C Programming
    Replies: 2
    Last Post: 11-07-2004, 12:58 PM
  2. Mouse 'control' prob in OpenGL
    By gazsux in forum Game Programming
    Replies: 5
    Last Post: 04-17-2003, 10:00 AM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. bitmaps and mouse location
    By Drakon in forum C++ Programming
    Replies: 3
    Last Post: 07-21-2002, 11:27 AM
  5. OpenGL question
    By Malek in forum Windows Programming
    Replies: 1
    Last Post: 09-10-2001, 12:00 PM