| 2878 | //============================================================================// |
| 2879 | |
| 2880 | int LuaOpenGL::RenderMode(lua_State* L) { |
| 2881 | CheckDrawingEnabled(L, __FUNCTION__); |
| 2882 | |
| 2883 | const GLenum mode = (GLenum)luaL_checkint(L, 1); |
| 2884 | if (!lua_isfunction(L, 2)) { |
| 2885 | luaL_error(L, "Incorrect arguments to gl.RenderMode(mode, func, ...)"); |
| 2886 | } |
| 2887 | |
| 2888 | |
| 2889 | // call the function |
| 2890 | glRenderMode(mode); |
| 2891 | const int top = lua_gettop(L); |
| 2892 | const int error = lua_pcall(L, top - 2, LUA_MULTRET, 0); |
| 2893 | const GLint oldmode = glRenderMode(GL_RENDER); |
| 2894 | |
| 2895 | if (error != 0) { |
| 2896 | LuaLog(1, "gl.RenderMode: error(%i) = %s", error, lua_tostring(L, -1)); |
| 2897 | lua_error(L); |
| 2898 | } |
| 2899 | |
| 2900 | lua_pushinteger(L, oldmode); |
| 2901 | lua_replace(L, 1); |
| 2902 | return lua_gettop(L); |
| 2903 | } |
| 2904 | |
| 2905 | |
| 2906 | int LuaOpenGL::SelectBuffer(lua_State* L) { |
nothing calls this directly
no test coverage detected