Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
glfw Use OpenGLRaw-3 Apr 12, 2016
src/Util add wiki-t5-3D Jan 12, 2014
wikibook update to linear-1.18 Oct 28, 2015
.gitignore Add stack.yml Oct 28, 2015
.travis.yml travis: add .travis.yml Dec 4, 2014
LICENSE Add first example: triangle-direct Dec 1, 2013 readme: use cabal sandbox, make apt-get explicit Jun 30, 2016
Setup.hs Add stack.yml Oct 28, 2015
haskell-OpenGL-examples.cabal cabal: allow OpenGLRaw-3.2 & singletons-2.1 Jun 24, 2016
stack.yaml Use GLUtil-0.9 Apr 12, 2016

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.

You can’t perform that action at this time.