danini-the-panini / mittsu

3D Graphics Library for Ruby.
https://github.com/danini-the-panini/mittsu
MIT License
508 stars 33 forks source link

JRuby Support #102

Open danini-the-panini opened 3 years ago

danini-the-panini commented 3 years ago

Work around some issues which prevented Mittsu from running on any version of JRuby.

  1. Fiddle does not automatically convert function arguments to pointers unless they have a to_ptr method. Fiddle::Closure does not have a to_ptr method, and therefore cannot be passed as an argument (e.g. GLFW callbacks). Manually converting them to a pointer works around this issue.
  2. Similarly, Ruby integers do not have a to_ptr method, And must therefore be manually converted to pointers before being passed as function arguments.
  3. nil, however, is automatically converted to a nullptr in JRuby (and thus works as a suitable substitute for 0)

TODO:

headius commented 3 years ago

We are willing (and eager) to make improvements to JRuby's fiddle impl! Some of these seem like things we should fix at the source. Great work!