Compiling Ocaml, SDL and OpenGL on Windows (mini tutorial)

January 7th, 2008

One of two ways to get OpenGL into Ocaml is by using GLCaml binding. It is up to date and alive. GLCaml also includes so called compact drop-in binding for SDL SDLCaml. I am not much of a low level guy so I had real trouble figuring out how to compile the thing on windows and almost gave up. But the author replied to my mail and gave me few crucial hints which made it all work.

NeHe tutorial number 9 in GLCaml

Here is what to do:

  1. Download and install Ocaml for windows (the MingW version)
  2. Install MingW. Install at least the C package, but NOT make.
  3. Install MSys (also from MingW site) which also installs its own make.
  4. Install the SDL library for mingw. Unzip and copy it to appropriate folders in mingw or make sure mingw can find it.
  5. Unzip glcaml.zip somewhere, and go to that location with MSys shell. When you are there run make in MSys.
  6. All examples should compile (the binding has many SDL and OpenGL) examples.

Thanks to Elliot for making the binding and replying to my mail. I hope I will dig Ocaml and make something concrete with it and this binding. Here is some more info and screens GLCaml and SDLCaml.

Enjoy the camel ride!

3 Responses to “Compiling Ocaml, SDL and OpenGL on Windows (mini tutorial)”

  1. JonBey Says:

    I intend to learn Ocaml and Haskell too. I started with haskell. I am currently experimenting with HOpenGL. Do you intend to make any more tutorials?

  2. Jon Harrop Says:

    Very nice! I’ll be adding some GLCaml examples using GLSL shaders to our site ASAP…

  3. janko Says:

    Great! As I said in python post comments, examples on your website were really interesting (they show various very interesting things one can do in ocaml (renderer, physics, sudoku) and they were main to inspire me to start tackling with OCaml.

Leave a Reply