diff options
author | sanine <sanine.not@pm.me> | 2023-03-12 00:12:39 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-03-12 00:12:39 -0600 |
commit | b2f8ef6dad8925b43b87015e2c10b12f10a2f415 (patch) | |
tree | eca64efe16963e7a861a6da551fc48a1c5acf3e3 /demo/vector/common.lua | |
parent | 13745925df1c7ba12fb0cbe80e36fa0681a89b5e (diff) |
remove glfw binds from opengl
Diffstat (limited to 'demo/vector/common.lua')
-rw-r--r-- | demo/vector/common.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/demo/vector/common.lua b/demo/vector/common.lua index 7ddd487..4ae36f9 100644 --- a/demo/vector/common.lua +++ b/demo/vector/common.lua @@ -1,15 +1,15 @@ honey.run = function() local gl = honey.gl - local window = honey.window + local glfw = honey.glfw -- initialize opengl - gl.Init() - window.setHint(window.hintType.contextVersionMajor, 3) - window.setHint(window.hintType.contextVersionMinor, 3) + glfw.Init() + --window.setHint(window.hintType.contextVersionMajor, 3) + --window.setHint(window.hintType.contextVersionMinor, 3) - local win = window.create(640, 480, 'first person demo') - honey.window.win = win - window.makeContextCurrent(win) + local win = glfw.CreateWindow(640, 480, 'honey3d', glfw.monitor_NULL, glfw.window_NULL) + glfw.MakeContextCurrent(win) + glfw.win = win gl.InitGlad() gl.Enable(gl.DEPTH_TEST) @@ -17,7 +17,7 @@ honey.run = function() honey.init() end - window.setFramebufferSizeCallback(win, function(_, width, height) + glfw.SetFramebufferSizeCallback(win, function(_, width, height) if honey.windowSizeCallback then honey.windowSizeCallback(width, height) end @@ -25,13 +25,13 @@ honey.run = function() local time = 0 drawTime = 1/60 - while not window.shouldClose(win) do - local t = window.getTime() + while glfw.WindowShouldClose(win) == glfw.FALSE do + local t = glfw.GetTime() local dt = t-time time = t honey.update(dt) - window.pollEvents() + glfw.PollEvents() if time > drawTime then if honey.clearColor then @@ -46,13 +46,13 @@ honey.run = function() end gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT) honey.draw() - window.swapBuffers(win) + glfw.SwapBuffers(win) drawTime = drawTime + 1/60 end end - window.destroy(win) - gl.Terminate() + --window.destroy(win) + glfw.Terminate() end |