Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ann: Using OpenGL with the native OCaml Graphics module

16 views
Skip to first unread message

Elliott Oti

unread,
Feb 12, 2007, 8:05:37 AM2/12/07
to
I've always thought it would be nice if it were possible to use OpenGL
calls in a window created with the Ocaml Graphics module. This would
prevent the need to require external toolkits such as SDL or GLUT for
some applications.

The Ocaml Graphics module is quite limited compared to SDL or GLUT,
and also fills a slightly different niche, but it does come with a
number of useful functions for drawing text, various graphics
primitives, and for polling mouse and keyboard events. Simple
standalone programs or demos can be created and distributed without
requiring that the SDL or GLUT shared library be present on those
systems.

To get an Ocaml window working with OpenGL I wrote a small stub file
in C and a few lines of ML code. A gzipped tar file containing all
necessary code to get OpenGL working in a native Ocaml graphic window,
along with an example for windows and linux, can be obtained from
http://www.elliottoti.com/code/glgraphics/glgraphics.tar.gz

A screenshot and a little more documentation is available at
http://www.elliottoti.com/index.php?p=24

0 new messages