lua-users home
lua-l archive

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


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