tjammer / raylib-ocaml

OCaml bindings for raylib and raygui
https://tjammer.github.io/raylib-ocaml/
MIT License
175 stars 14 forks source link

`Raylib.Rlgl.set_uniform_matrix` matrix argument `Raylib__.Raylib_types.Matrix.t` seems incompatible to `Raylib.Matrix.t`. #37

Closed gravicappa closed 10 months ago

gravicappa commented 11 months ago

Passing second argument for Raylib.Rlgl.set_uniform_matrix of a type Raylib.Matrix.t results in a type error:

Error: This expression has type
         Raylib.Matrix.t = Raylib.Matrix.t' Raylib.ctyp
       but an expression was expected of type
         Raylib__.Raylib_types.Matrix.t =
           (Raylib_fixed_types.Matrix.t, [ `Struct ])
           Ctypes_static.structured

Creating the same matrix with Raylib__.Raylib_types.Matrix.create helps but I have a suspicion that it's a not expected behaviour. Did I miss something?

raylib-ocaml is of version 1.1.0.

tjammer commented 11 months ago

You didn't miss anything, I did. The type Raylib.Matrix.t is simply not usable with the Rlgl module in the current version. I tried not to expose the raw ctypes types in all their glory and hid too much information.

I pushed a fix to the master branch (https://github.com/tjammer/raylib-ocaml/commit/967aeeabc352cfc230198ce8a188c61a0eae420a). If you're using opam, you can pin the raylib package to this commit until I release a new version to opam. Since raylib 5.0 came out some time ago I think updating the bindings to 5.0 makes sense before pushing a new binding version to opam. I hope I can find the time before Christmas.

tjammer commented 10 months ago

I just released the upgrade to raylib 5.0.0 which includes these changes