OpenGL in Haskell

I’m working on a maze game to learn Haskell. It’s name: DuDuHoX. The reason is explained in my portuguese blog.

The first game interface is for console. It uses the package System.Console.ANSI. Works pretty well in Linux and Mac OS, except for Windows which has a small buffer problem, forcing the player to hit enter after every move.

DuDuHoX versão console

I decided to create a new interface for the game this week. With graphics and with no buffer problem for Windows.

At first, I tried to use SDL, because I’ve used it to create a maze game in C. Had no success, couldn’t even compile an example.

Thought about using OpenGL directly for graphics, but didn’t know what to use to manage user input. I’ve seen some complaints about OpenGL and GLUT in this regard. After some searches, I found GLFW, a C open-source library that do everything I need, and the most important: there is a GLFW Haskell package that does the binding.

After some hours learning OpenGL and GLFW in Haskell, this is the result:

DuDuHoX versão gráfica

You can play with this new interface, but the console one has more features. So, for the next weeks, I’ll try to add these features and some nice textures to the OpenGL interface. The TODO list and the code is available at GitHub:

Happy 2013!


2 thoughts on “OpenGL in Haskell

  1. All I've done so far uses the ancient OpenGL fixed function pipeline. I'm switching over to shaders and just discovered that the OpenGL package does not support “glUniformMatrix4fv”.

    Started delving into OpenGLRaw package to realize GLFW package depends on the higher level OpenGL package. I'm glad you've suggested GLFW-b, as it is self-contained, I'll be able to use it without depending on OpenGL package.

    I'll post about it as soon as I get something working. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s