[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: SDL vs GLUT (multiplexing of mouse and keyboard events)



Abhir Joshi wrote:
I have observed that SDL does better multiplexing of mouse and
keyboard events than GLUT.

For instance, consider we have a space program with a space ship
moving.  I am using mouse to control the direction of motion and
keyboard for applying forward thrust.  With SDL event handling it
works perfect, but with GLUT, the mouse events are given priority over
keyboard events.
I don't think GLUT does anything at all fancy.  As each X event is
reported, GLUT calls the appropriate callback.

I can't imagine what SDL might be doing that's different.

Initially, say, I am moving the ship forward using keyboard.  When I
move the mouse, this forward motion virtually stops and the ship just
changes direction and when I stop the movement of mouse, the ship's
forward motion starts again.
I've never seen this kind of behavior.

Are you maybe doing something like redrawing the scene in the mouse/keyboard
callback?

How can this problem be solved with GLUT?  Can multi-threading help in
any way?
You shouldn't need to do that.

PUI uses GLUT's event callbacks.  So using PUI, I will have the same
problem.  Isn't PUI written using SDL event handling?
No - PUI doesn't require any special windowing system interface.  It uses
neither GLUT nor SDL.

The application program tells PUI when to redraw and what keystrokes and
mouse clicks it should use.

---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1@airmail.net>    WorkEmail: <sjbaker@link.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net    http://tuxaqfh.sf.net
           http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----