lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Feb 21, 2011 at 12:16 AM, Michael Gogins
<michael.gogins@gmail.com> wrote:
> Such a binding already exists. I am using it with good results. It
> includes OpenGL and GLU, OpenCL, and GLFW (which enables mouse and
> keyboard interaction via polling, valuable since so far LuaJIT/FFI
> does not support callbacks into Lua from C). If a function or enum in
> the binding is missing or wrong, it is easy to correct by reference to
> the library documents.
>
> http://github.com/malkia/luajit-opencl
>
> Highly recommended!
>

I already used that in my yet-another game of life implemetation:
https://github.com/archilifelin/mysandbox/blob/master/lua/lifegame_ffi_sdl_gl.lua

which is quite fun to work with! This was meant to be a comparison to
SDL/GL code written in C/C++, performance-wise. The result was more
than satisfactory, as LuaJIT FFI being on par or faster than C/C++
SDL/GL program in 3 cases (out of 4), the only one slower was because
that method called glVertex3f() too many times in the same iteration.
(Other 3 methods being a single call to glDrawArray, VBO and PBO).

The code was crappy here and there, because my programming skill is
still crappy. If you are interested by the results and has any
corrections to made, please do tell me :)

the C++ version is here:
https://github.com/archilifelin/mysandbox/tree/master/cpp/lifegame_sdl