diff options
author | sanine <sanine.not@pm.me> | 2023-05-11 23:10:42 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-05-11 23:10:42 -0500 |
commit | 5fc7e7a76086809b3817b9eac627f65441790b0d (patch) | |
tree | 467740393c157cc4efa399582ec6fd99e72ecf2c | |
parent | f5b103de5b2b48433ce2895a1a73df40c4e86bf8 (diff) |
add deletion functions for gl buffers and vertex arrays
-rw-r--r-- | src/opengl/data.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/opengl/data.c b/src/opengl/data.c index b7dc581..bda8881 100644 --- a/src/opengl/data.c +++ b/src/opengl/data.c @@ -8,10 +8,12 @@ #include "gl.h" int gl_create_buffer(lua_State *L); +int glDeleteBuffers_bind(lua_State *L); int gl_bind_buffer(lua_State *L); int gl_buffer_data(lua_State *L); int gl_vertex_array_create(lua_State *L); +int glDeleteVertexArrays_bind(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); @@ -22,10 +24,12 @@ void setup_data(lua_State *L, int gl_index) struct honey_tbl_t tbl[] = { /* functions */ H_FUNC("GenBuffers", gl_create_buffer), + H_FUNC("DeleteBuffers", glDeleteBuffers_bind), H_FUNC("BindBuffer", gl_bind_buffer), H_FUNC("BufferData", gl_buffer_data), H_FUNC("GenVertexArrays", gl_vertex_array_create), + H_FUNC("DeleteVertexArrays", glDeleteVertexArrays_bind), H_FUNC("BindVertexArray", gl_vertex_array_bind), H_FUNC("VertexAttribPointer", gl_vertex_attrib_pointer), H_FUNC("EnableVertexAttribArray", gl_vertex_array_enable_attrib), @@ -57,6 +61,14 @@ int gl_create_buffer(lua_State *L) } +int glDeleteBuffers_bind(lua_State *L) +{ + int buf = luaL_checkinteger(L, 1); + glDeleteBuffers(1, &buf); + return 1; +} + + int gl_bind_buffer(lua_State *L) { int target = luaL_checkinteger(L, 1); @@ -131,6 +143,14 @@ int gl_vertex_array_create(lua_State *L) } +int glDeleteVertexArrays_bind(lua_State *L) +{ + int array = luaL_checkinteger(L, 1); + glDeleteVertexArrays(1, &array); + return 1; +} + + int gl_vertex_array_bind(lua_State *L) { lua_Integer array = luaL_checkinteger(L, 1); |