From b2f8ef6dad8925b43b87015e2c10b12f10a2f415 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 12 Mar 2023 00:12:39 -0600 Subject: remove glfw binds from opengl --- demo/vector/common.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'demo/vector/common.lua') 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 -- cgit v1.2.1