From b6ccd8b31a78ef99f8c346d9b60f123c7ac813ec Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 19 Aug 2022 14:48:26 -0500 Subject: enable hello triangle --- src/gl/gl.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gl/gl.c b/src/gl/gl.c index 7364b1c..485d412 100644 --- a/src/gl/gl.c +++ b/src/gl/gl.c @@ -24,6 +24,7 @@ int gl_buffer_data(lua_State *L); int gl_vertex_array_create(lua_State *L); int gl_vertex_array_bind(lua_State *L); int gl_vertex_attrib_pointer(lua_State *L); +int gl_vertex_array_enable_attrib(lua_State *L); /* shaders */ int gl_create_shader(lua_State *L); @@ -84,6 +85,7 @@ void setup_gl(lua_State *L, int honey_index) hs_str_cfunc("createVertexArray", gl_vertex_array_create), hs_str_cfunc("bindVertexArray", gl_vertex_array_bind), hs_str_cfunc("vertexAttribPointer", gl_vertex_attrib_pointer), + hs_str_cfunc("vertexArrayEnableAttrib", gl_vertex_array_enable_attrib), hs_str_tbl("bufferTarget", buffer_binding_targets), hs_str_tbl("bufferUsage", buffer_usage_patterns), @@ -163,7 +165,7 @@ int gl_buffer_data(lua_State *L) /* build raw buffer */ size_t len = lua_objlen(L, table); - lua_Number *buf = malloc(len * sizeof(lua_Number)); + float *buf = malloc(len * sizeof(float)); if (buf == NULL) hs_throw_error(L, "failed to allocate intermediary buffer"); for (int i=0; i