[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grabbing the pointer with OpenGL
Mads Bondo Dydensborg wrote:
> Well, I use a Ppro 232 with a dual V2 and a Matrox millinium - which means
> that I render into software when I do not run fullscreen. My game runs at
> about 4 fps in wireframe mode in software. In a small window.
Yeah - well. With a small window and only 4Hz update rate, I could easily
imagine the mouse escaping. I was thinking 30 to 60Hz and maybe a quarter-screen
window *at least*.
> > 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!)
> Maybe this was a good idea. A quick ltrace seems to indicate the
> "XChangePointerControl" is the call. The man page seems to confirm this.
> Then I only need to figure out how I find my display - which would seem to
> be XOpenDisplay. (To get the current values of the pointer,
> XGetPointerControl would seem to be the preferred choice).
Right. With that, you can set up the mouse speed so it can't cover a distance
equal to half your windows' smallest dimension in less than your frame time.
> If I can not get things to work with glutWarpPointer, then I think I will
> be looking into this.
You'll still *need* glutWarpPointer.
> (btw: ltrace is wonderfull, if you do not have the source to a program
> that you are almost certain uses libs. I know I could download the source,
> but this took about 10 seconds to do).
Indeed - I was assuming that there would be more than just one simple call.
> I warp the pointer in the glut callback function. (And sets a flag to
> avoid endless loops - is there a smarter way to avoid this?)
The glut *render* callback - right?
If you do it in the mouse, timer or (worst of all) idle callback - then
that could be a problem.
> > glutWarpPointer...or XGrabPointer if I'm not using GLUT for some reason.
> If you use glutWarpPointer, I guess I can too. ;-)
Well - maybe not at such slow frame rates...I generally assume a minimum of
~20Hz and a 640x480 window - if you are down to (say) 4Hz and a 320x240 window
on a 1600x1200 desktop...
> > > 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 thought it called XWarpPointer?
Oh - sorry - I guess you're right. (I didn't read what you wrote - sorry!)
I guess that would be a better solution...but it's not portable.
> Well, that depends. For my next project I want to use libraries (I plan to
> use plib, btw - people keeps recommending it :-)
(Well - *I* keep recommending it - and Mark Collins appears to be recommending
it in Chapter 7 of his new book....Oh - wait... :-)
> For this I plan on
> trying to do things myself, as part of a learning process. (Which may or
> may not be a good thing).
You need a certain knowledge of this stuff even if you are planning on using
something higher level like PLIB.
Steve Baker HomeEmail: <firstname.lastname@example.org>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sourceforge.net
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org