diff options
Diffstat (limited to 'src/gl/gl.c')
-rw-r--r-- | src/gl/gl.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/gl/gl.c b/src/gl/gl.c index c4502dc..4639d48 100644 --- a/src/gl/gl.c +++ b/src/gl/gl.c @@ -20,36 +20,34 @@ int gl_get_error(lua_State *L); void setup_gl(lua_State *L, int honey_index) { - int data_types = hs_create_table(L, - hs_str_int("uchar", GL_UNSIGNED_BYTE), - hs_str_int("uint", GL_UNSIGNED_INT), - hs_str_int("int", GL_INT), - hs_str_int("float", GL_FLOAT), - ); - - int error_types = hs_create_table(L, - hs_str_int("noError", GL_NO_ERROR), - hs_str_int("invalidEnum", GL_INVALID_ENUM), - hs_str_int("invalidValue", GL_INVALID_VALUE), - hs_str_int("invalidOperation", GL_INVALID_OPERATION), - hs_str_int("invalidFramebufferOperation", GL_INVALID_FRAMEBUFFER_OPERATION), - hs_str_int("outOfMemory", GL_OUT_OF_MEMORY), - ); - int gl_index = hs_create_table(L, - hs_str_cfunc("init", gl_init), - hs_str_cfunc("initGlad", glad_init), - hs_str_cfunc("terminate", gl_terminate), - hs_str_cfunc("getError", gl_get_error), - - hs_str_tbl("dataType", data_types), - hs_str_tbl("errorType", error_types), + /* functions */ + hs_str_cfunc("Init", gl_init), + hs_str_cfunc("InitGlad", glad_init), + hs_str_cfunc("Terminate", gl_terminate), + hs_str_cfunc("GetError", gl_get_error), + + /******** enums ********/ + /* data types */ + hs_str_int("UNSIGNED_BYTE", GL_UNSIGNED_BYTE), + hs_str_int("UNSIGNED_INT", GL_UNSIGNED_INT), + hs_str_int("INT", GL_INT), + hs_str_int("FLOAT", GL_FLOAT), + + /* error types */ + hs_str_int("NO_ERROR", GL_NO_ERROR), + hs_str_int("INVALID_ENUM", GL_INVALID_ENUM), + hs_str_int("INVALID_VALUE", GL_INVALID_VALUE), + hs_str_int("INVALID_OPERATION", GL_INVALID_OPERATION), + hs_str_int("INVALID_FRAMEBUFFER_OPERATION", GL_INVALID_FRAMEBUFFER_OPERATION), + hs_str_int("OUT_OF_MEMORY", GL_OUT_OF_MEMORY), ); setup_shader(L, gl_index); setup_drawing(L, gl_index); setup_data(L, gl_index); setup_texture(L, gl_index); + lua_setfield(L, honey_index, "gl"); } |