[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grabbing the pointer with OpenGL
Mads Bondo Dydensborg wrote:
> I am in the process of writing a game, that needs to control a viewpoint
> with the mouse, much in the same way Quake does.
>
> The solution I have devised, uses glutWarpPointer to make the mouse stay
> in the center of the window, then glutPassiveMotionFunc to get the
> events. This works, controlwise, but quite often the mouse escapes my
> window for a brief moment, then returns. Which is annoying.
You can move the mouse all the way from the center of the window (where
you are presumably warping it to) to the edge of the window in less than
one iteration of your games' main loop?
Wow!
You either have a VERY fast hand - or a VERY slow program! ....OH!...
*OR* you may have your mouse set up to be super-sensitive or have
mouse 'accelleration' turned on.
I guess you could make the mouse less sensitive. You can do that
with the 'xset mouse ' program - but I have no idea how you do that at
the level of X-windows calls (but you have the source to 'xset' - so
you can find out and tell us!)
You'd want to be VERY careful to restore it when the game exits and
(my pet hate) be sure to allow a way to 'release' the mouse during
the game (maybe in Pause mode or something) so that you can park
the game and do something else.
I'm sceptical about this though...
* Are you *sure* you warp the pointer EVERY frame?
* Are you putting it into the MIDDLE of the window?
> So, what do you guys use?
glutWarpPointer...or XGrabPointer if I'm not using GLUT for some reason.
> I have looked at XGrabPointer, but I ran away scared by the man page. And
> it is not very portable either, I guess.
...and in any case, that's all glutWarpPointer does.
> I would like to stay with OpenGL and glut if at all possible - these are
> the only libraries my game depends on at the moment.
Good plan!
--
Steve Baker HomeEmail: <sjbaker1@airmail.net>
WorkEmail: <sjbaker@link.com>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sourceforge.net
http://tuxaqfh.sourceforge.net
http://tuxkart.sourceforge.net
http://prettypoly.sourceforge.net
http://freeglut.sourceforge.net
---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk