No description, website, or topics provided.
Haskell GLSL
Switch branches/tags
Nothing to show

I am not maintaining this project. If you would like to adopt it, please drop me a line, and I'll hand it over.

Comparative examples of Modern OpenGL in Haskell

These are the examples I wish I had when I started learning OpenGL. There are more examples in the wild of the deprecated pre-3.0 API than of modern OpenGL, and of course nearly all are in C(++). The usual assortment of GLUT and other windowing frameworks doesn't help.

These examples (will eventually) cover several different choices of Haskell wrapper over OpenGL:

  • modern buffers & VAOs using the OpenGL package
  • GLUtil wrappers to reduce boilerplate & imperative style
  • vinyl-gl (extensible Haskell records, GHC type hackery) to remove more boilerplate

All examples use GLFW-b for windowing. There are a few helper functions in src/Util which are used in all the examples.

If you are using these examples and find something missing or difficult to understand, please open an issue. Pull requests are also welcome.

The example programs:

  • wikibook ports a few examples from the excellent OpenGL Wikibook
  • glfw (2D rotating triangle, based on the example that ships with GLFW)

I recommend building all of the examples as follows (the first line is Ubuntu-specific):

apt-get install libgl-dev libxcursor-dev libxi-dev libglu-dev
cabal sandbox init
cabal install

Take a look at the .cabal file to see how the executables are named.


Vladimir Lopatin has a good set of tutorials on modern OpenGL in Haskell. They have more detail on interactions with GLFW-b and do not use GLUtil or vinyl-gl.