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 ++++++++++++++-------------- demo/vector/main.lua | 6 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'demo/vector') 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 diff --git a/demo/vector/main.lua b/demo/vector/main.lua index 2b29999..28090c6 100644 --- a/demo/vector/main.lua +++ b/demo/vector/main.lua @@ -1,6 +1,6 @@ require 'common' -local window = honey.window +local glfw = honey.glfw local nvg = honey.nvg @@ -17,8 +17,8 @@ end local time = 0 local frames = 0 function honey.update(dt) - if window.getKey(window.win, window.KEY_ESCAPE) == window.PRESS then - window.setShouldClose(honey.window.win, true) + if glfw.GetKey(glfw.win, glfw.KEY_ESCAPE) == glfw.PRESS then + glfw.SetWindowShouldClose(glfw.win, true) end time = time + dt -- cgit v1.2.1