MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / RenderMode

Method RenderMode

src/lua/LuaOpenGL.cpp:2880–2903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2878//============================================================================//
2879
2880int 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
2906int LuaOpenGL::SelectBuffer(lua_State* L) {

Callers

nothing calls this directly

Calls 7

LuaLogFunction · 0.85
luaL_errorFunction · 0.50
lua_gettopFunction · 0.50
lua_pcallFunction · 0.50
lua_errorFunction · 0.50
lua_pushintegerFunction · 0.50
lua_replaceFunction · 0.50

Tested by

no test coverage detected