Haskell Life With Repa Part 2: Parsing Framework

Conway's Life - Gunstar

Life Pattern - Gunstar

In the last post, we built a simulator for Conway’s Life in Haskell using repa and OpenGL. The initial life pattern in that implementation was hard coded. In this post, I’ll build a framework for parsing patterns from files.

Read the rest…

Tags: , ,

Comments (1)


Conway’s Life in Haskell with Repa and OpenGL

Conway's Life in Haskell

The final state after starting with the acorn pattern

Repa is a new library in Haskell for handling arrays. It has flexible indexing like the old array library, but supports parallel computation, stream fusion, and has a rich API like the vector library.

To learn how to use repa, I implemented Conway’s Life using repa for the simulation and OpenGL for the display. The complete code is available on BitBucket and builds on my GLFW-b boilterplate, so I’ll only discuss the interesting parts here. Don Stewart wrote a good introductory tutorial to repa that will fill in any gaps I leave in this post.

Read the rest…

Tags: , , , ,

Comments (1)


OpenGL in Haskell: GLFW-b Boilerplate

Haskell is turning out to be a great match for OpenGL. Since we can offload a lot of the rendering to shader code, we can use mostly pure Haskell functions to update the game or simulation in response to user input. Over a few blog posts, I’m going to outline how I’ve been using OpenGL in Haskell.

First, to use OpenGL we need a way to open a window, get a context, and respond to user input. There are several different cross-platform libraries to do this, but for simple projects I prefer GLFW. The Haskell package GLFW-b has bindings for GLFW and exposes a more Haskellish API than the regular GLFW package. Read the rest…

Tags: , ,

Comments (2)


How To Configure Onion Skinning in GAP

The Gimp Animation Package, or GAP, is a plugin that lets you do video or animation in Gimp. Like most plugins in Gimp, it is both very powerful and very unfriendly. If you have done animation in a program like Flash, you are used to having frames laid out along a visual timeline. The timeline in Flash has a bracket to show the onionskin range, which is the frames you will see overlaid on the current frame to help create a smooth animation.

None of this is readily apparent in GAP. Each frame is a separate Gimp file, and GAP sees that they’re part of the same animation because the file names end with successive numbers. There is an onion skinning item in the GAP menu (cleverly disguised as Video), but it doesn’t seem to do anything until you configure it correctly.

To configure onion skinning in GAP, go to Video » Onionskin » Configuration…. The onionskin configuration in GAP is exquisitely flexible and confusing. Here is how to configure onion skinning in GAP for a couple of common scenarios. Note that I’m using Gimp 2.8.2. Read the rest…

Tags: , ,

Leave a Comment


Five Great Reasons to Blog Lists

Source: Flickr user Ex-Smith

So you’re trying to make money blogging? Want to be a pro blogger? Here are five great reasons why you should write all of your blog posts as lists.

Read the rest…

Tags: ,

Leave a Comment