Jump to content

  • Log In with Google      Sign In   
  • Create Account

Handling mouse outside opengl window


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Alessandro   Members   -  Reputation: 284

Like
0Likes
Like

Posted 18 October 2012 - 09:27 AM

In my opengl application I use the mouse to rotate the camera and action stops when the mouse cursor is outside the opengl window.
There is a way to continuously handle mouse data even if it is outside such window, or even if it reaches screen boundaries?
I can't use GLUT and I need to have a solution for both Windows and OSX.
Maybe I could have the cursor never leaving the opengl window? So that when it reaches a boundary it resets to the screen center?

Thanks

Sponsor:

#2 Goran Milovanovic   Members   -  Reputation: 882

Like
1Likes
Like

Posted 19 October 2012 - 01:34 AM

It's common practice to constantly move the mouse cursor back to screen center:

vec2_offset = getMousePosition()
setMousePosition(vec2_center)

As you probably realized, vec2_offset (being a vector) encodes mouse movement direction and speed, which is exactly what you need.
Learn the basics with my Python 3 video tutorial series. Looking for a good game engine, and relevant tutorials? Here you go.
Small and simple Python 3.x media library: pslab

#3 Alessandro   Members   -  Reputation: 284

Like
0Likes
Like

Posted 19 October 2012 - 01:48 AM

Thank you very much




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS