LuaJIT binding to OpenGL
To load the library, use the require
function:
local luajit_glfw = require "glfw" -- from https://github.com/sonoro1234/LuaJIT-GLFW
local luajit_gl = require "gl"
luajit_gl.set_loader(luajit_glfw) -- also can be SDL2 from https://github.com/sonoro1234/LuaJIT-SDL2
LuaJIT-GL loads the following libraries:
luajit_gl.gl
: OpenGLluajit_gl.glc
:#defined
values for OpenGL (this must be a Lua table instead ofstatic const
values, because OpenGL useslongs
in a couple of places)luajit_gl.glu
: GLUluajit_gl.glext
: A table that, when indexed, loads and returns the specified extension function. Ex.glext.glMyExtFuncARB(p1, p2)
You can also use the following snippet to concisely localize the libraries.
local gl, glc, glu, glext = luajit_gl.libraries()