summaryrefslogtreecommitdiff
path: root/src/gl/gl.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-18 22:46:40 -0500
committersanine <sanine.not@pm.me>2022-08-18 22:46:40 -0500
commit275536b36657744d802866c060654e2b5cd5a5f8 (patch)
treee685ed8d665fd629c19cbfc39095402d71e349fc /src/gl/gl.c
parent253f1d1ca8b4b81f206e4aeb20afe440a6dae8be (diff)
implement working windows
Diffstat (limited to 'src/gl/gl.c')
-rw-r--r--src/gl/gl.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gl/gl.c b/src/gl/gl.c
new file mode 100644
index 0000000..8613e70
--- /dev/null
+++ b/src/gl/gl.c
@@ -0,0 +1,34 @@
+#include "gl/glad/glad.h"
+#include <GLFW/glfw3.h>
+#include <lua.h>
+#include <honeysuckle.h>
+
+
+int gl_init(lua_State *L);
+int gl_terminate(lua_State *L);
+
+
+void setup_gl(lua_State *L, int honey_index)
+{
+ hs_create_table(L,
+ hs_str_cfunc("init", gl_init),
+ hs_str_cfunc("terminate", gl_terminate)
+ );
+ lua_setfield(L, honey_index, "gl");
+}
+
+
+int gl_init(lua_State *L)
+{
+ if (!glfwInit()) {
+ hs_throw_error(L, "failed to initialize GLFW");
+ }
+ return 0;
+}
+
+
+int gl_terminate(lua_State *L)
+{
+ glfwTerminate();
+ return 0;
+}