lua-users home
lua-l archive

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


Hi Benjamin,

I have some FFI bindings for OpenGL, and they work for me: OSX (32-bit, 64-bit), Windows (32-bit, 64-bit) and Ubuntu 11.04 linux (and probably othes - again 32-bit and 64-bit).

http://github.com/malkia/ufo - it comes with precompiled luajit, and few other dlls (glfw, anttweakbar, and zeromq).

Thanks,
Dimiter "malkia" Stanev

On 4/30/11 9:07 PM, Benjamin Segovia wrote:
Hello all,

I am experimenting luaJIT and its FFI. Unfortunately, while trying to
process a rather big loop, the trace aborts on the first C function
call done via the FFI.

Here, I load openGL symbols in "gl" via the FFI. When glClear (see
pasted code) is called, trace aborts with error "symbol not in cache"

here is the code:

function render_system:render()
   gl.glClear(gl.GL_COLOR_BUFFER_BIT)

   -- all squares first
   local sq = self.render_world.square
   gl.glBegin(gl.GL_QUADS)
     for _,square in pairs(sq) do
       local c = square.color
       local p = square.center
       local s = square.size
       gl.glColor3f(c[1],c[2],c[3])
       gl.glVertex3f(p[1]+s[1], p[2]+s[2], p[3]+s[3])
       gl.glVertex3f(p[1]+s[1], p[2]-s[2], p[3]+s[3])
       gl.glVertex3f(p[1]-s[1], p[2]-s[2], p[3]+s[3])
       gl.glVertex3f(p[1]-s[1], p[2]+s[2], p[3]+s[3])
     end
   gl.glEnd()
end

AM I doing something wrong? Or is it the normal behaviour?

I just fetched the last luaJIT version from git HEAD.

Thanks!
Ben