From 249833947ff691dd79453c4d817387a6922236d6 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 22 Aug 2022 11:38:26 -0500 Subject: add element buffers --- src/gl/drawing.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gl/drawing.c') diff --git a/src/gl/drawing.c b/src/gl/drawing.c index a64f56d..ca914e0 100644 --- a/src/gl/drawing.c +++ b/src/gl/drawing.c @@ -5,6 +5,7 @@ int gl_set_viewport(lua_State *L); int gl_draw_arrays(lua_State *L); +int gl_draw_elements(lua_State *L); int gl_set_clear_color(lua_State *L); int gl_clear(lua_State *L); @@ -24,6 +25,7 @@ void setup_drawing(lua_State *L, int gl_index) hs_create_table(L, hs_str_cfunc("drawArrays", gl_draw_arrays), + hs_str_cfunc("drawElements", gl_draw_elements), hs_str_cfunc("setClearColor", gl_set_clear_color), hs_str_cfunc("clear", gl_clear), hs_str_cfunc("setViewport", gl_set_viewport), @@ -62,6 +64,15 @@ int gl_draw_arrays(lua_State *L) } +int gl_draw_elements(lua_State *L) +{ + lua_Integer mode, count, type, offset; + hs_parse_args(L, hs_int(mode), hs_int(count), hs_int(type), hs_int(offset)); + glDrawElements(mode, count, type, (const void*)offset); + return 0; +} + + int gl_set_viewport(lua_State *L) { lua_Integer x, y, w, h; -- cgit v1.2.1