Wed, 13 Dec 2000 Andreas Podgurski wrote:
Well, you really want to write the mouse pointer on the back buffer right
before you flip, since otherwise you lose the mouse pointer as soon as you
perform the flip.
No, I don’t want. I want to implement the same system I had on my old 486 to
do a mouse pointer. In this case, I’m moving the mouse pointer around on the
front surface, just like in a single buffer app, while the application is drawing the
other buffer. This system is still suitable while running on slow systems.
Ok, I get the point! (And I’m feeling right at home, as this is very similar to
what that old DOS game I’ve been tolking about is doing.
The really nice way to do this is by using tripple buffering. And that’s not
the way DirectX usually does it (circulating the buffers), but treating the
third buffer as an off-line rendering target, that replaces one of the other
buffers when it’s ready.
Obviously, in your case, you’ll actually need quadruple buffering, as you need
to have two buffers ready before you can do the switch. (Unless the machine
is fast enough at copying full buffers…)
Shurly, the pointer is drawn into the back buffer before flipping just as it is erased
in the back buffer after flipping, but most drawing is done on the front screen. On
some (old) systems page flipping is not hardware accellerated an you can get max
10-12 frames, which is still enough for my application but too slow for a good mouse
pointer. Trust me, I know what I’m doing ;-).
This is very important if the pointer is to be usable. On the Amiga (full
frame rate, raster synced mouse pointer), I used to draw free-hand, but that
just won’t work with PC mice using the standard 20-30 Hz Win95/98 drivers.
(Many mice can be tuned up to 200 Hz, but Win95/98 drivers usually don’t
support that - probably just to make sure serious users switch to some other
OS…)
Now, speaking pointers, there is another problem with modern mice; they’re not
raster synced. This basically means that they won’t move smoothly even if you
speed them up to several times the frame rate! Same problem as the
interference phenomena you get with a decoupled game loop without
interpolating coordinates. I’d like to see a mouse driver where that’s
fixed… (Perhaps an XFree86 hack?)
//David
…- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' ..- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -’