Hi there.
I'm using GLUT for a new project, because I would prefer to avoid dealing with a lot of win32 code for window initialization, and the advantage of making my project more portable is nice too.
I'm having a problem using the mouse for camera input, because when the mouse hits the edge of the screen, I can no longer use the mouse to keep turning because the cursor does not go beyond the edge.
The answer would be to reset the cursor to the center of the screen (either when it hits the edge or every time I read the mouse cursor's movement). But GLUT does not have a function for this, so I have to revert to using an OS dependant call to windows.h SetCursorPos(int x, int y)..
Any ideas as to how I can avoid using windows.h to achieve the same results ?
Thanks.
GLUT mouse coordinates
Started by radioteeth, Aug 02 2007 08:10 PM
2 replies to this topic
#1
Posted 02 August 2007 - 08:10 PM
#2
Posted 02 August 2007 - 08:49 PM
I'm not sure in GLUT itself but in libsdl, there's a function called SDL_WM_GrabInput, which can be passed a parameter to grab mouse input outside the application window (as well as inside). Look for something similar in GLUT.
Imagine.
#3
Posted 03 August 2007 - 12:33 AM
You can use :
glutWarpPointer( glutGet( GLUT_WINDOW_WIDTH )/2, glutGet( GLUT_WINDOW_HEIGHT )/2 );
This will put the mouse pointer in the middle of your window.
I'm using freeglut (http://freeglut.sourceforge.net/)
glutWarpPointer( glutGet( GLUT_WINDOW_WIDTH )/2, glutGet( GLUT_WINDOW_HEIGHT )/2 );
This will put the mouse pointer in the middle of your window.
I'm using freeglut (http://freeglut.sourceforge.net/)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











