OGLFW 0.4, Ocaml bindings for GLFW 2.4.2
Quite some time ago (2003, I think) I wrote an Ocaml wrapper for the GLFW library. I came across it recently and decided to release it to the public, for what it’s worth.
Screenshots
From the readme.txt:
This release is version 0.4.
At this point there are no guarantees whatsoever with regards
to usability, compilability, correctness, or stability.
About
glfw (http://glfw.sourceforge.net) is an open-source framework for OpenGL
application development.
ocaml (http://www.ocaml.org) is a functional programming language.
oglfw is a collection of C and ML source code that can be used to call glfw
functions directly from ocaml. The tool camlidl
was used to generate most of the function wrappers. The source code for
glfw callbacks was taken from camlgl source code (see below).
A binding for glfw 2.3.0 already exists: camlgl
This consists, as far as I can tell, of handwritten wrapper code. The difference
between camlgl and oglfw is negligible.
* oglfw wraps version 2.4.2; camlgl wraps version 2.3.0.
Contents
The file oglfw-0.4.tar.gz contains the following files:
- makefile
- readme.txt
- lib/glfw.h - camlidl-generated header file
- lib/oglfw.c - c stub code (partly generated from camlidl, partly handwritten)
- lib/glfw.ml - ml functions and constants
- lib/glfw.mli - ml function interface
- examples/keytest.ml - example file based on the glfw keytest.c example, adapted from the camlgl distribution
- examples/listmodes.ml - example file based on the glfw listmodes.c example
- examples/mthello.ml - example file based on the glfw mthello.c example
- examples/triangle.ml - example file based on the glfw triangle.c example. Utilises lablGL
- examples/mipmaps.ml - example file based on the glfw mipmaps.c example. Utilises lablGL
Building
This has only been tested under mingw and mandrake linux 10.0, with ocaml 3.08 (mingw version) and gcc 3.2
It will probably work as well with ocaml > 3.05 and gcc >= 2.95.2 under both mingw and linux
It may work with ocaml 3.06 (msvc version) and Microsoft Visual C++ 6.0.
It does not work with ocaml 3.06 (msvc version) and the free version of Visual C++ Net that comes
with the Dot Net SDK, either version 1.0, or 1.1; there are linker problems.
Required:
- ocaml 3.08 (mingw version if building on windows)
- msys (optional, for building on windows )
- gcc 3.2 (may work with versions from 2.95.2 and up but this is untested)
- glfw 2.4.0 or later
- camlidl 1.01 or later
- lablGL 1.0 or later (for the examples mipmaps and triangles )
Unzip all files into a directory and run make.
Usage
The file keytest.ml is an example of how it may be used. Assumes both glfw and camlidl are installed and available.
On windows/MinGW build with:
ocamlopt -o keytest.exe oglfw.c glfw.mli glfw.ml keytest.ml -cclib -lglfw -cclib -lopengl32 -cclib -lglu32 -cclib -lcamlidl -cclib -lole32
On Linux build with:
ocamlopt -o keytest.exe oglfw.c glfw.mli glfw.ml keytest.ml -cclib -L/usr/X11R6/lib -cclib -lglfw -cclib -lGLU -cclib -lGL -cclib -lX11 -cclib -lXxf86vm -cclib -lXext -cclib -lpthread -cclib -lm -cclib -lcamlidl
Comments
No comments yet.
RSS feed for comments on this post.
Leave a comment
Sorry, the comment form is closed at this time.

