Background: Defcon does not call the function glFinish() every frame; according to spec, this function makes sure all graphics operations are executed before it returns. Not calling it will, on some systems, cause lag between input and graphics because there may be several already computed frames in a queue waiting to be rendered, and by the time they finally appear on screen, they are a bit out of date. glFinish() flushes this queue.
If the UI of Defcon is already smooth for you and there is no feelable delay between your real mouse movement and the movement of the pointer on the screen, you don't have to read on. You won't profit from this mod.
Luckily for the rest, Defcon is linked dynamically against SDL in Linux. While you can't (easily) modify Defcon's code on your own, SDL is open source and you can modify SDL's code and replace the version of SDL that comes with Defcon with your own version.Step by step instructions to do so, smuggling in a glFinish() call:
$ tar -xzf4. apply the patch:
/SDL-1.2.11.tar.gz $ cd SDL-1.2.11/
$ patch <5. compile regularly:
/defcon_glfinish.patch -p 1 patching file src/video/SDL_video.c
$ ./configure6. copy the resulting library into the defcon library folder:
$ cp build/.libs/libSDL-1.2.so.0.11.07. launch defcon and enjoy!
If this is too complicated or you don't have the required tools installed and you trust me (you shouldn't!), here is the bzipped result of the operations above. Just unbzip it and put it into Defcon's lib directory.
Effect for me on my work PC with a crappy NVidia FX 5200 card: input lag reduction of one or two frames, which is an easily feelable improvement when you only get 20 FPS.
On my home PC with an NVidia 6800, there is no effect, although there is feelable mouse lag in the menu. It goes away either way in a multiplayer game.
The downside: on NVidia cards (and I hear ATI cards as well), calling glFinish() blocks the CPU and makes the calling program use 100% of its time. Boo for NVidia. I think ATI is no better. On SOME systems, replacing glFinish() with glFlush() in the patch works just as well without this drawback. YMMV.