I am trying to get started with some basic Ocaml programming. To start I wanted to get the OpenGL example from wikipedia running. http://en.wikipedia.org/wiki/Ocaml
let _ =
ignore( Glut.init Sys.argv );
Glut.initDisplayMode ~double_buffer:true ();
ignore (Glut.createWindow ~title:"OpenGL Demo");
let angle t = 10. *. t *. t in
let render () =
GlClear.clear [ `color ];
GlMat.load_identity ();
GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. ();
GlDraw.begins `triangles;
List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
GlDraw.ends ();
Glut.swapBuffers () in
GlMat.mode `modelview;
Glut.displayFunc ~cb:render;
Glut.idleFunc ~cb:(Some Glut.postRedisplay);
Glut.mainLoop ()
The given compiler directive
ocamlc -I +lablGL lablglut.cma lablgl.cma simple.ml -o simple
Just causes and error on line 2, saying that Glut.init is unbound.
I am running this on cygwin, which could be the source of the problem. But does anybody know how to fix it?