diff options
author | sanine <sanine.not@pm.me> | 2022-08-22 11:00:42 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-22 11:00:42 -0500 |
commit | a2c162f12337142c054c2e1f01ad508ee56963d2 (patch) | |
tree | 80fb3c8cbd8f08000423d5dc961986be07978c28 /demo | |
parent | dccc9bef56d51c5cad13c2568c5a3b97f637fd6e (diff) |
refactor: move data functions into separate file
Diffstat (limited to 'demo')
-rw-r--r-- | demo/honey.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/demo/honey.lua b/demo/honey.lua index fce264c..5e14461 100644 --- a/demo/honey.lua +++ b/demo/honey.lua @@ -67,23 +67,23 @@ local vertices = { 0.0, 0.5, 0.0 } -local vertexArray = gl.createVertexArray() +local vertexArray = gl.data.createVertexArray() -local vertexBuffer = gl.createBuffer() -gl.bindVertexArray(vertexArray) +local vertexBuffer = gl.data.createBuffer() +gl.data.bindVertexArray(vertexArray) -gl.bindBuffer(gl.bufferTarget.arrayBuffer, vertexBuffer) +gl.data.bindBuffer(gl.data.bufferTarget.arrayBuffer, vertexBuffer) local err = gl.getError() if err ~= gl.errorType.noError then error(gl.errorName(err)) end -gl.bufferData(gl.bufferTarget.arrayBuffer, gl.dataType.float, vertices, gl.bufferUsage.staticDraw) +gl.data.bufferData(gl.data.bufferTarget.arrayBuffer, gl.dataType.float, vertices, gl.data.bufferUsage.staticDraw) if gl.getError() ~= gl.errorType.noError then error(gl.getError()) end -gl.vertexAttribPointer(0, 3, false, 3, 0) +gl.data.vertexAttribPointer(0, 3, false, 3, 0) if gl.getError() ~= gl.errorType.noError then error(gl.getError()) end -gl.vertexArrayEnableAttrib(0) +gl.data.vertexArrayEnableAttrib(0) if gl.getError() ~= gl.errorType.noError then error(gl.getError()) end -gl.bindBuffer(gl.bufferTarget.arrayBuffer, 0) +gl.data.bindBuffer(gl.data.bufferTarget.arrayBuffer, 0) if gl.getError() ~= gl.errorType.noError then error(gl.getError()) end while not window.shouldClose(w) do @@ -91,7 +91,7 @@ while not window.shouldClose(w) do gl.draw.clear(gl.draw.bufferMask.colorBuffer); gl.shader.use(shader) - gl.bindVertexArray(vertexArray) + gl.data.bindVertexArray(vertexArray) gl.draw.drawArrays(gl.draw.primitiveType.triangles, 0, 3) window.swapBuffers(w) |