summaryrefslogtreecommitdiff
path: root/demo/vector/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'demo/vector/common.lua')
-rw-r--r--demo/vector/common.lua28
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