glxgears to overcome a peculiar problem. This application would not write the FPS information to file (if redirected) unless it is shutdown.I checked the source code,
glxgears.c and found the problem was simply that there was no fflush statement after the output printf: static void
event_loop(Display *dpy, Window win)
{
....
if (t - t0 >= 5.0) {
GLfloat seconds = t - t0;
GLfloat fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n",frames, seconds,
fps); //no flushing!
t0 = t;
frames = 0;
}}}
}
And so, the solution seemed simple: add the line of code that would force the output buffer to flush (fflush(stdout);) after printf and re-compile the source code.To be able to compile
glxgears.c, however one needs to install many other libraries and packages. Here are the steps that I followed to get the whole thing working.glxgearsis part of the Mesa Library. I downloaded th latest source code (MesaLib-7.8.2.tar.gz)- Start by
untarringthis file:tar -xvf MesaLib-7.8.2.tar.gz - Enter the directory
Mesa-7.8.2and type: ./configure --with-driver=xlib. The configuration code will now start spitting out the libraries that it needs (and which your machine does not have). Following are the libraries that I needed on my machine: - libdrm:
sudo wget http://dri.freedesktop.org/libdrm/libdrm-2.4.21.tar.gz
tar -xvf libdrm-2.4.21.tar.gz
cd libdrm-2.4.21/
./configure
make
make install - xorg-macros:
wget http://mirrors.kernel.org/ubuntu/pool/main/x/xutils-dev/xutils-dev_7.5+4_i386.deb
sudo dpkg -r xutils-dev
sudo dpkg -i xutils-dev_7.5+4_i386.deb
ls /usr/share/pkgconfig/ - dri2proto:
wget http://xorg.freedesktop.org/releases/individual/proto/dri2proto-2.3.tar.gz
tar -xvf dri2proto-2.3.tar.gz
cd dri2proto-2.3/
./configure
make
make install - glproto:
wget http://xorg.freedesktop.org/releases/individual/proto/glproto-1.4.12.tar.gz
tar -xvf glproto-1.4.12.tar.gz
cd glproto-1.4.12/
./configure
make - xxf86vm:
sudo apt-get install libxxf86vm-dev - xdamage:
sudo apt-get install libxdamage-dev - After all the dependencies are satisfied,
./configure --with-driver=xlibwill complete and create themakefile. - Follow it up with:
make. Once you modify theMesa-7.8.2/progs/xdemos/glxgears.cfile, call./configure --with-driver=xlibandmake. The newglxgearsexecutable will be created in the same directory as the souce code.