OpenGL, Glut in Haskell on WindowsOkay so you are feeling little adventurous and want to try out some of your functional programming skills in Game and Graphics programming. Well how about Haskell afterall it is a hardcore FP Language which can be compiled or interpreted! Lets try it out with the good old utility library Glut. We will start with Haskell Platform which is Haskell distribution with many useful packages of which the most useful for us are the Glut and OpenGL bindings package. FreeGLut which is the completely open sourced version of Glut. Now we will save ourself a little time and LOT of hassle by downloading prebuild binaries instead of building ourself from Martin Payne's Windows binaries for MingW. Make sure you grab the MingW package as Haskell bindings for Glut seems to be build with MingW gcc. Now once you have downloaded and installed Haskell Platform, and unzipped the FreeGlut binaries, take the following code and copy to a HelloWorld.hs file.
import Graphics.Rendering.OpenGL import Graphics.UI.GLUT main :: IO () main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" displayCallback $= display mainLoop display :: IO () display = do clear [ ColorBuffer ] flush