[ocaml-opengl] [Caml-list] standard 3d vector library in OCaml

Daniel Bünzli daniel.buenzli at erratique.ch
Thu May 9 11:23:22 BST 2013


> 2013/5/8, Francois Berenger:
> > Hello,
> > 
> > Is there a standard library for this purpose?
It's not standard, unreleased and I hate to pre-announce but in the following months I plan to release Gg, a module that gives you basic types for 2D and 3D computer graphics; vectors, matrices, quaternions, axis-aligned boxes, colors and raster data.

Vectors and matrices are abstract but represented internally as records of floats. This allows to pass them directly to C functions that take double arrays and avoids bounds checking in OCaml code. The memory layout of matrices is also the one expected by OpenGL.

Except for the Raster module --- metadata for bigarrays to allow libraries to share raster data without depending on each other e.g. an OpenCV or image loading library and an OpenGL library --- the module is pretty stable now, it still needs a final code review though and one or two function names may change.

The current documentation of gg can be found here [1], the code can be browsed here [2]. It can also be installed via the erratique-unstable opam repo:

    opam repo add erratique-unstable http://erratique.ch/software/opam-unstable
    opam update 
    opam install gg

But I'd advise you not to that until the next release of opam because of this bug [3] which while harmless makes your `opam update` experience become unpleasant (you have to do a `opam remove gg`, before being able to `opam update`). 

Comments are welcome. 

Best,

Daniel


[1] http://erratique.ch/software/gg/doc/Gg.html
[2] https://github.com/dbuenzli/gg/
[3] https://github.com/OCamlPro/opam/issues/552





More information about the OpenGL mailing list