Archive

Archive for August, 2012

Yampa and OpenGL

In order to visualize behaviors/signals I needed Yampa and OpenGL to work together. Mun Hon Cheong has done this in his thesis Functional Programming and 3D Games. The source code for his game Frag is available here. After a bit of struggling I got my sine oscillator to animate the scale of an OpenGL sphere.

Animated sphere

Sorry about the video quality. The method that Mun Hon Cheong describes avoids using Yampas reactimate for running things (since there is no way to incorporate it into the glut mainloop). Instead, he suggests using reactinit and react. This works even though I find it ugly that things are rendered in the idle callback and not in the draw callback. A big step forward though – and many thanks to Mun Hon Cheong for his excellent work. My source code is available here and the file of interest is yampa_and_gfx.hs.

Categories: Uncategorized