This is a mega-repo for a real-time graphics renderer in Haskell.
- Backend definitions
- Primitives for drawing
- triangle strips
- triangle fans
- beziers (fill below curve) + inverted beziers (fill above curve)
- thick, feathered stroked lines and for creating new backends.
- Definitions and functions for post compilation affine transformation, color multiply, red channel replacement (for font textures)
Backend for compiling
gelatin pictures using OpenGL.
freetype2 text using character atlases and word maps for fast rendering. Use
this if your text changes frequently but does not often get resized. It is fast to
compile renderings but unless the text is rendered with a large character size, scaling up
the rendering will show pixels.
Functions for extracting truetype font geometry as
gelatin primitives. Use this
if your text resizes frequently but otherwise does not change. It is slow to compile
renderings but once compiled those renderings can be displayed at any scale.
SDL2 initialization and windowing.
WebGL backend via ghcjs (experimental)
gelatin depends on
You can install them with the following platform specific steps.
Mac OS X
brew install freetype brew install sdl2
First install freetype2
apt-get install libfreetype6
The sdl2 bindings require an sdl2
install >= 2.0.4, or for special instructions to be followed. Assuming you're
Ubuntu >= 16.04, you can simply run
apt-get install libsdl2-dev
otherwise please visit the link above and install via their README.
Windows 10 with MSYS2/MINGW
pacman -S mingw-w64-x86_64-pkg-config mingw-w64-x86_64-freetype mingw-w64-x86_64-SDL2
The easiest way to get up and running on the Haskell toolchain is to download stack. All of gelatin's projects are spec'd out with stack.yaml build files, so picking the correct versions of libraries is not needed if you follow the stack path.
git clone https://github.com/schell/gelatin.git cd gelatin
If you just installed stack, run
Go make some ☕ and then...
Note on Windows that if you run into this error
ghc-pkg.EXE: C:\sr\snapshots\3c4ad812\pkgdb\package.cache: you don't have permission to modify this file
You can simply run
stack build over and over until the thing finally compiles.
facepalm - this will be fixed with ghc 8.2.
Drink your ☕, take a walk and rejoice...
I welcome any and all contributions. Feel free to tackle an issue (or a TODO) by making a pull request!
If you'd like to make a donation you can do so through patreon.
This library will always be free.