diff options
author | sanine <sanine.not@pm.me> | 2022-08-19 13:53:18 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-19 13:53:18 -0500 |
commit | 899e70147ff7c866f131ba7bfb98193c4e68027f (patch) | |
tree | 11a445f572f6a4525f6ae2cac3a6086c094d1cf5 /src/gl/window.c | |
parent | ecde0c8110da1c1f94cce7f6a1fa9406d04eca69 (diff) |
add shaders and basic drawing functions
Diffstat (limited to 'src/gl/window.c')
-rw-r--r-- | src/gl/window.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gl/window.c b/src/gl/window.c index 8434a5a..cb30d3f 100644 --- a/src/gl/window.c +++ b/src/gl/window.c @@ -6,8 +6,10 @@ int window_create(lua_State *L); int window_destroy(lua_State *L); +int window_make_context_current(lua_State *L); int window_should_close(lua_State *L); int window_poll_events(lua_State *L); +int window_swap_buffers(lua_State *L); void setup_window(lua_State *L, int honey_index) @@ -15,8 +17,10 @@ void setup_window(lua_State *L, int honey_index) hs_create_table(L, hs_str_cfunc("create", window_create), hs_str_cfunc("destroy", window_destroy), + hs_str_cfunc("makeContextCurrent", window_make_context_current), hs_str_cfunc("shouldClose", window_should_close), - hs_str_cfunc("pollEvents", window_poll_events) + hs_str_cfunc("pollEvents", window_poll_events), + hs_str_cfunc("swapBuffers", window_swap_buffers), ); lua_setfield(L, honey_index, "window"); } @@ -46,6 +50,16 @@ int window_destroy(lua_State *L) } +int window_make_context_current(lua_State *L) +{ + void *ptr; + hs_parse_args(L, hs_light(ptr)); + GLFWwindow *win = ptr; + glfwMakeContextCurrent(win); + return 0; +} + + int window_should_close(lua_State *L) { void *ptr; @@ -61,3 +75,13 @@ int window_poll_events(lua_State *L) glfwPollEvents(); return 0; } + + +int window_swap_buffers(lua_State *L) +{ + void *ptr; + hs_parse_args(L, hs_light(ptr)); + GLFWwindow *win = ptr; + glfwSwapBuffers(win); + return 0; +} |