AboutGLCaml is an Objective Caml interface for OpenGL versions 1.1, 1.2, 1.3, 1.4, 1.5, 2.0 and 2.1, plus extensions, for the Windows, Linux, Solaris and Mac OS-X operating systems on both 32-bit and 64-bit machines. It consists of three files: glcaml.ml, glcaml.mli and glcaml_stub.c, and is intended as a compact drop-in binding rather than a big standalone library. It is licensed under the BSD License. The bindings are generated using cleaned up header files from the glext project on Sourceforge. GLCaml is a direct, not particularly type-safe binding to OpenGL. It has the following features:
- Inspired by camlgl.sourceforge.net, GLCaml loads the OpenGL library dynamically ("OpenGL32.dll" on windows, "libGL.so.1" on Linux, "libGL.dylib" on OS-X)
- OpenGL functions are loaded dynamically and memoized, once loaded, to speed up future calls.
- Naming conventions are exactly the same as in the traditional 'C' OpenGL API.
- Enumerated constants (Glenums) are in gl_lower_case format.
- Function names have the exact same names in OCaml as in 'C'
- This binding is wholly automatically generated and contains hundreds of function bindings, the vast majority of which have not been tested. Use at your own risk.
This version of GLCaml has major API changes with respect to the previous versions. The following changes have been made:
- Bigarrays are no longer necessary for using OpenGL functions. Standard Ocaml types (ints, floats, bools and strings and corresponding arrays) are now used.
- Enumerated constants (glenums) have been replaced by ints. As a result, there are no more GL_ALL_CAPS constants; these have been replaced by gl_no_caps ints
- An exception is now always thrown if an OpenGL call is not available. This is because silent fails can leave mutable parameters in an undefined state.
Using GLCaml, SDLCaml and WinGLCaml can be used in combination with OcamlSDL, the canonical binding for SDL, or Jean-Christophe Filliatre's SDL bindings, or with lablgtk's GTKGlArea. It can even be used with Ocaml's Graphics module using the Win module bindings provided in this package. Optional bindings for SDL are also provided along with the GLCaml package to enable instant usage, if so desired. The lablgl OpenGL bindings are typesafe, elegant and portable. However, it only covers OpenGL 1.2. In addition, it's statically linked to the OpenGL import library. Another OpenGL binding for Ocaml is Nickolay Kolchin-Semyonov's camlgl. It extends OpenGL support to version 1.5 and loads all functions dynamically. It is however unmaintained at the moment. Sean C. Chapel has built GLCaml on OS-X, and reports that it works with OcamlSDL on OS-X. It has to be compiled with -framework SDL in order to get it to work. GLCaml supports almost all OpenGL ARB and vendor extensions. The GLCaml package also contains SDLCaml, a compact drop-in binding for LibSDL. SDLCaml can be used as a small, fast replacement for OcamlSDL. It contains the following files
- A TGA file reader, able to read 15,16,24 and 32 bit-per-pixel TGA files, both run-length encoded and uncompressed.
- Texture-map scaling functions, with a number of different scaling filters.
- A texture mipmap generator, using the scaling functions to generate mip-maps suitable for OpenGL
- A bitmapped font library, based on the SFONT specifications