[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (OT) Re: OpenGL scenegraph

Jan Ekholm wrote:

> Sometimes it's quite handy to have black boxes with stuff that just work
> when you feed stuff to it. I don't want to know how my Xlib calls in the
> libX11.so black box work, nor how the stuff in libc. I don't want to
> reinvent the entire wheel all the time, sometimes I'd be happy to have
> premanufactured parts...

Then think of it in this way: understanding a bit (not much, just a
bit!) about the underlying transport protocol that Xlib uses to talk
with the X server can lead you to use it better. Things like:

 - knowing what functions do a round-trip (having to wait for two
context switches and a lot of copying to finish)
 - how the actual blitting is done in the X server process (allowing you
to put XFlush and XSync calls in judicious places, letting your game
code run in parallel to the blitting as much as possible)
 - how XShm sidesteps the X protocol stream (explaining why you get
flickering sometimes and how not just to "fix it" with an XSync)
 - when a pixmap would be faster than a shared image for an image that
is not often changed, like an icon (the server could put it in
framebuffer memory and use hardware blitting to get it on the screen)
 - how to use DGA properly as to get the best out of it (not easy, you
don't have any accelerator functions at hand, and video memory is so
slow it should) be considered unreadable

It makes the difference between a 10 fps game and a 60 fps game. And if
you can't *see* that difference, maybe you should do something else! ;-)

Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi