Legacy OpenGL immediate-mode bindings for OCaml
  • OCaml 96%
  • Dune 2.5%
  • Shell 1.5%
Find a file
2026-01-12 11:40:13 +01:00
.github/workflows set OCAMLCI 2026-01-12 11:04:40 +01:00
bin fmt 2026-01-12 09:33:00 +01:00
docs fmt 2026-01-12 09:33:00 +01:00
lib fmt 2026-01-12 09:33:00 +01:00
test fmt 2026-01-12 09:33:00 +01:00
.ocamlformat fmt 2026-01-12 09:33:00 +01:00
CHANGELOG.md docs 2025-09-29 21:33:34 +02:00
cube.png add cube image 2025-09-24 13:54:07 +02:00
dune-project try win32 2025-10-02 19:46:46 +02:00
gl-legacy.opam maintenance-intent tag 2025-10-03 09:44:02 +02:00
gl-legacy.opam.template template 2025-10-03 09:56:42 +02:00
LICENSE set OCAMLCI 2026-01-12 11:04:40 +01:00
make_docs.sh docs 2025-09-29 21:33:34 +02:00
README.md readme 2026-01-12 11:40:13 +01:00
triangle.png rename 2025-09-22 22:41:36 +02:00

gl-legacy

Legacy OpenGL immediate-mode bindings for OCaml

Use this together with tgls for a complete coverage of (more) modern OpenGL.

Work in Progress

API Documentation

https://sanette.github.io/gl-legacy/

Examples

To run the demos:

  • Make sure tsdl is installed, or run
opam install tsdl

Note: on Windows you might need to do instead:

opam pin https://github.com/sanette/tsdl.git
  • Then
mv bin/dune.moveme bin/dune
dune exec bin/triangle.exe
dune exec bin/cube.exe
dune exec bin/cube_lit.exe
dune exec bin/cube_list.exe

triangle

cube

This one requires in addition tsdl-image and tgls:

cd bin; dune exec ./image_quad.exe

Code sample

(...)

    Gl_legacy.gl_begin Gl_legacy.triangles;
    Gl_legacy.color3f 1.0 0.0 0.0;
    Gl_legacy.vertex2f 0.0 0.8;
    Gl_legacy.color3f 0.0 1.0 0.0;
    Gl_legacy.vertex2f (-0.8) (-0.8);
    Gl_legacy.color3f 0.0 0.0 1.0;
    Gl_legacy.vertex2f 0.8 (-0.8);
    Gl_legacy.gl_end ();

(...)

But why?

  • Why old openGL?

Because it's a lot easier to program, has some pedagogical value, and allows me to run old code I wrote in the the good old times.

  • But there's already lablgl and glMLite!

True. Good question. The goal is to have a minimal set of bindings that would complement tgls (See the image_quad example).