GLCaml project 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 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 GNU Lesser General Public License.The bindings are generated with the file convert.ml using cleaned up header files from the glext project on Sourceforge. GLCaml is a direct, not particularly type-safe binding to OpenGL.Here are some key features of "GLCaml":· 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_ALL_CAPS format. · Where in C an OR-ed combination of Glenums is passed to a function, in OCaml a list of glenums is passed· Function names have the exact same names in OCaml as in 'C'· Where OpenGL functions require an array for either input or output, a Bigarray of the appropriate type is used.· To this end, types for Bigarrays of bytes, floats, ints, doubles etc have been defined.· The function set_failwith -> bool -> unit determines whether a failed GL call throws a Failure exception or fails silently.· This permits graceful recovery from non-available OpenGL functions, if so desired. · 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.GLCaml can be used in combination with OcamlSDL, the canonical binding for SDL, or Jean-Christophe Filliatre's SDL bindings, or with lablgtk's GTKGlArea. 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. SDLCaml does not work out-of-the-box on OS-X and will need some tweaking to get references to SDL_main correct.GLCaml supports the following extensions: GL_ARB_imaging GL_ARB_matrix_palette GL_ARB_multitexture GL_ARB_vertex_blend GL_ATI_envmap_bumpmap GL_ATI_map_object_buffer GL_ATI_pn_triangles GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_vertex_streams GL_ATIX_point_sprites GL_ATIX_texture_env_combine3 GL_ATIX_texture_env_route GL_ATIX_vertex_shader_output_point_size GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_pixel_buffer_object GL_EXT_secondary_color GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_rectangle GL_EXT_vertex_shader GL_KTX_buffer_region GL_NV_fragment_program2 GL_NV_fragment_program_option GL_NV_vertex_program2_option GL_NV_vertex_program3The 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 sdlcaml.mlsdlcaml.mlisdlcaml_stub.calong with comprehensive documentation and a number of SDL tutorials, translated into Ocaml from the Lazy Foo' Productions tutorials. In addition to the SDL bindings, SDLCaml contains the following convenience functions, all written in OCaml:· 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 specificationsWhat's New in This Release:· This release contains significant API changes.· Bigarrays are no longer necessary to use OpenGL functions.· Standard Ocaml types (ints, floats, bools, strings, and corresponding arrays) are sufficient.· Glenums have been replaced by integer constants, and as a result, GL_ALL_CAPS notation becomes gl_small_letters.· Silent error handling has been removed.· Extra examples have been added, including an OpenGL shader demo.· A new module, Win, has been added to allow the use of OpenGL from standard Ocaml Graphics module windows.