summaryrefslogtreecommitdiff
path: root/src/gl/drawing.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-22 11:38:26 -0500
committersanine <sanine.not@pm.me>2022-08-22 11:38:26 -0500
commit249833947ff691dd79453c4d817387a6922236d6 (patch)
tree9fb1666f6ad443e13c5c6376ea949fbce6e58cfd /src/gl/drawing.c
parenta2c162f12337142c054c2e1f01ad508ee56963d2 (diff)
add element buffers
Diffstat (limited to 'src/gl/drawing.c')
-rw-r--r--src/gl/drawing.c11
1 files changed, 11 insertions, 0 deletions
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;