This is true ALSA multi-threaded capturing! This my first, ALSA and POSIX thread application. Happy that it works as intended(well I hope the cubes jumped much higher but hey..they jump!). Drawing is done on one thread and the capturing is done on another. Make sure you set the recording source for ALSA to your system out. It was easy for me because ALSA is managed(to an extent) by PulseAudio(don’t worry, the application does not include anything PulseAudio). pavucontrol makes it easier to set the source to the system’s output’s monitor.
Here’s how to compile this,
g++ -I. -o dance ogl.cc alsa.cc -DdDOUBLE -lGL -lGLU -lglut -lode -lasound
Please have the ALSA development package installed.
ALSA code was ripped out from Linux Journal’s web site, thank you!
Enter “Balls from heaven”! This is an improvement to the bouncing ball application I posted before, I left it as the way I found the code snippets from multiple sample projects and tutorials, now that I’ve got the hang of it more stuff can be done. The source includes links to some sites that I’ve found important for ODE and OpenGL.
The source is in standard C++, and uses (Open)GL, GLUT and GLU. To compile on Windows with MSVC++ you’d need to edit, but for MingW you’d not need to edit(linking might be hard, I haven’t done it though). On any Linux you can compile with the following commands IF you have ODE(in the repos by the name libode), OpenGL(usually comes by default, but if you are running with prop drivers make sure the linker sees that libGL.so) GLU and GLUT make sure you’ve installed those, commands that are used to install those are in the previous post.
g++ -o balls ogl2.cc -DdDOUBLE -lGL -lGLU -lglut -lode
This is a ball colliding with an unseen surface, using ODE and OpenGL. Took a lot of time to get my head around ODE because there are no good tutorials or simpler sources to learn from.
You need to install the following(Ubuntu)
sudo apt-get install freeglut3-dev
sudo apt-get install libode-dev
For other OSs install ODE by source, I’d recommend you to keep on to gcc.
g++ -o ball ogl.cc -DdDOUBLE -lGL -lGLU -lglut -lode