local glfw = honey.glfw local gl = honey.gl local window = require 'honey.window' local module = {} setmetatable(module, {__index=_G}) setfenv(1, module) function init(width, height, title) local width = width or 640 local height = height or 480 local title = title or "honey3d" glfw.Init() glfw.WindowHint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) glfw.WindowHint(glfw.CONTEXT_VERSION_MAJOR, 4) glfw.WindowHint(glfw.CONTEXT_VERSION_MINOR, 1) local window = honey.Window(width, height, title) glfw.MakeContextCurrent(window.win) gl.InitGlad() gl.Enable(gl.DEPTH_TEST) honey.ode.InitODE() honey.mesh.createBuiltins() return window end function loop(window, update) local prevTime = 0 while not window:shouldClose() do local time = glfw.GetTime() local dt = time - prevTime if dt > 1/60 then prevTime = time update(dt) window:swapBuffers() glfw.PollEvents() end end end function terminate() glfw.Terminate() end return module