[ruby-opengl-devel] FFI backend for ruby-opengl

Jan Dvorak jan.dvorak at kraxnet.cz
Wed Mar 25 20:53:20 EDT 2009


Hello,
> Dear all, dear Alain
>
> I wonder if there might be some interest in using ruby-ffi[1] as a
> backend for ruby-opengl. Actually, a prototypal FFI support for opengl
> already exists: ffi-opengl[2]. The idea is to use the FFI binding as a
> glue code between ruby-opengl and the opengl C libraries, delegating to
> ruby-opengl the high level stuff.
>
> I'll try to summarize some of the benefits I see in this approach:
>
> * ruby-opengl would be multi-platform and multi-implementation
>
> The extension would work without changes on Ruby, Rubinius, JRuby (and
> on any other ruby implementation that supports FFI)
>
>   
Support for JRuby and other implementations would be really nice, and is
definitely something to aim for.
> * The install process would be oversimplified
>
>   * No compilation needed anymore
>   * No need to install development dependencies
>
>   
OTOH it would add dependency on FFI (and ruby-ffi), which needs to be
compiled as well.
> * ruby-opengl code would be simpler to maintain
> * low-level stuff would be separated from the high-level one:
>   
Most of the 'high-level' stuff besides function calls in ruby-opengl is
stuff like error checking, range and type tests etc., that translate to 
ruby pretty much line-for-line, so i doubt it would simplify the code by
any big amount. I'm also concerned about the performance impact of
moving all this stuff into ruby code. IIRC the python opengl bindings
were doing it this way and as a result were lagging behind in
performance (i may be wrong though).

Another thing is, the code that would need to be rewritten in ruby is
like 90% of whole ruby-opengl, so instead of adding ffi as backend to
ruby-opengl, it would be simpler to just start afresh on ffi-opengl.

best regards,
Jan



More information about the ruby-opengl-devel mailing list