PDA

View Full Version : mouse coordinates



weetzie
04-15-2004, 02:28 AM
hi all.
i need to get the mouse coordinates independent from any application window. That means that if the cursor gets out of the visible screen, still coordinates should exist.
For example glutMotionFunc() seems to offer only window-relative x- & y-coordinates.

If anyone has a clue how to solve my problem please let me know.

thx

Relic
04-15-2004, 04:52 AM
Not an advanced OpenGL topic, but the answer under Win 32 is to use SetCapture() and ReleaseCapture().
For example, if you press the mouse button you call SetCapture(hwnd) and all mouse events will continue to go to your window even if the mouse is outside the client area, and when you release the button, call ReleaseCapture() and the mouse coordinates are handled as usual.

For conversion from window client to screen coordinates there is ClientToScreen().