lua-users home
lua-l archive

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

Alex wrote:
> The FFI headers I'm using were parsed from GLEW on my Windows x64, which is
> probably why they are there. I'll try re-processing the headers tomorrow in
> Linux and see if it clears up.

Umm, you may get into trouble if you process headers on 64 bit and
use them on 32 bit, anyway. That is, unless you're very, very
careful to abstract out all the word size dependencies with
ptrdiff_t, size_t, intptr_t, uintptr_t etc. And then there are
some libraries which have incompatible APIs on each platform,
hidden behind a mess of macros ...

> gllib = setmetatable({}, {__index=function(self,k) return lookup[k] and
> glew[lookup[k]] or gl[k]})
> I'm not quite sure how else to redirect them short of using the GLEW
> internal functions everywhere.

The first thing that comes to mind is to cache the lookup result
in the table.

But the real question is why do you use GLEW at all? This may be
convenient for C/C++, but the LuaJIT FFI offers lots more magic to
automate all of that. There are several FFI GL bindings out there,
and someone must have solved that problem nicely by now.