From f1444d38ed6c8a350cbeb6edd01306df42ccf2f6 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 12 Mar 2023 00:44:46 -0600 Subject: add glGetString bind --- src/opengl/gl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/opengl') diff --git a/src/opengl/gl.c b/src/opengl/gl.c index 532d818..6643f5f 100644 --- a/src/opengl/gl.c +++ b/src/opengl/gl.c @@ -18,6 +18,7 @@ int glad_init(lua_State *L); int gl_get_error(lua_State *L); int gl_enable(lua_State *L); int gl_disable(lua_State *L); +int glGetString_bind(lua_State *L); void setup_gl(lua_State *L, int honey_index) { @@ -27,6 +28,7 @@ void setup_gl(lua_State *L, int honey_index) H_FUNC("GetError", gl_get_error), H_FUNC("Enable", gl_enable), H_FUNC("Disable", gl_disable), + H_FUNC("GetString", glGetString_bind), /******** enums ********/ /* data types */ @@ -47,6 +49,12 @@ void setup_gl(lua_State *L, int honey_index) H_INT("DEPTH_TEST", GL_DEPTH_TEST), H_INT("CULL_FACE", GL_CULL_FACE), + /* strings */ + H_INT("VENDOR", GL_VENDOR), + H_INT("RENDERER", GL_RENDERER), + H_INT("VERSION", GL_VERSION), + H_INT("SHADING_LANGUAGE_VERSION", GL_SHADING_LANGUAGE_VERSION), + H_END }; create_table(L, tbl); @@ -90,3 +98,12 @@ int gl_disable(lua_State *L) glDisable(cap); return 0; } + + +int glGetString_bind(lua_State *L) +{ + int name = luaL_checkinteger(L, 1); + const char *str = glGetString(name); + lua_pushstring(L, str); + return 1; +} -- cgit v1.2.1