dbuenzli / tgls

Thin bindings to OpenGL {3,4} and OpenGL ES {2,3} for OCaml
http://erratique.ch/software/tgls/
ISC License
54 stars 7 forks source link

Update sample code to compile with latest tsdl #19

Closed lvicentesanchez closed 8 years ago

lvicentesanchez commented 8 years ago

I'm trying to compile trigl3.ml using the following line:

ocamlfind ocamlopt -linkpkg -package tsdl,tgls.tgl3 -o trigl3.native \
                         trigl3.ml

And I get the following error:

File "trigl3.ml", line 176, characters 2-61:
Error: This expression has type
         unit Tsdl.Sdl.result = (unit, [ `Msg of string ]) Result.result
       but an expression was expected of type [< `Error of 'a | `Ok of 'b ]

I have installed both tgls and tsdl using opam and then I check out this repository. Am I missing something?

lvicentesanchez commented 8 years ago

I have the same problem when I try to compile trigl4.ml

lvicentesanchez commented 8 years ago

Versions:

tgls 0.8.3 tsdl 0.9.0

lvicentesanchez commented 8 years ago

Downgrading to tsdl 0.8.2 solves the problem

dbuenzli commented 8 years ago

The problem is that tsdl switched to the result type that is upcoming in OCaml 4.03.0, however no release of tgls happened since then so the sample code is outdated.

I'd still advise you to use tsdl 0.9.0 and simply replace the polymorphic variant result type [Ok of 'a |Error of 'b] by the new result type (available in the result opam compatibility package) since this is the way forward.

(Reopening so that I don't forget to update the sample code)