3d graphics for Standard ML

About SML3d

The SML3d project is a collection of libraries that support programming real-time 3D graphic applications in Standard ML using the OpenGL library.


The following components of the SML3d project are fairly complete and functional:


The SML3d library ( is the core library that provides access to OpenGL, as well as support for common graphics types and operations, such as vectors, matrices, quaternions, cameras, and view frustums. It is currently based on the OpenGL 2.1 API, but we plan to move to a design that is compatible with the OpenGL 4.x API in the near future.


GFW is a lightweight portable library for the system specific aspects of a 3d graphics application. It includes support for creating windows and handling keyboard and mouse input.

Image I/O

The Image I/O library provides support for reading and writing a number of common image-file formats.

Movie generation

The movie generation library provides support for generating MPEG4 and x264 encoded videos from an SML3d application. This library requires that mencoder (part of the mplayer system) be installed.

Object-file loaders

There are several libraries for loading some common 3D object-file formats. These include Wavefront obj and mtl files, MD3 files, and MD5 files.


This library provides an SML API for the OpenAL 1.1 library for sound as well as some support for loading WAV files.


The OpenCL library provides an SML interface to the host-side OpenCL API. The OpenCL library is also distributed as a standalone library in a separate download.

Raw data

The raw-data library handles the interface to arrays of scalar C types (e.g., arrays of unsigned 16-bit integers). These arrays are used to implement vertex buffers, textures, and images for OpenGL, as well as to implement the memory objects used in the OpenCL library.