diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 0a38b2562..c4d8e5526 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -312,7 +312,7 @@ namespace opengl void Graphics::reset() { DisplayState s; - discardMask(); + discardStencil(); Canvas::bindDefaultCanvas(); restoreState(s); } @@ -451,7 +451,7 @@ namespace opengl return 4; } - void Graphics::defineMask() + void Graphics::defineStencil() { glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glEnable(GL_STENCIL_TEST); @@ -460,14 +460,14 @@ namespace opengl glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); } - void Graphics::useMask(bool invert) + void Graphics::useStencil(bool invert) { glStencilFunc(GL_EQUAL, (int)(!invert), 1); // invert ? 0 : 1 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } - void Graphics::discardMask() + void Graphics::discardStencil() { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDisable(GL_STENCIL_TEST); diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index bf2aa0c94..742802e43 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -252,7 +252,7 @@ namespace opengl /** * Enables the stencil buffer and set stencil function to fill it */ - void defineMask(); + void defineStencil(); /** * Set stencil function to mask the following drawing calls using @@ -260,12 +260,12 @@ namespace opengl * @param invert Invert the mask, i.e. draw everywhere expect where * the mask is defined. */ - void useMask(bool invert = false); + void useStencil(bool invert = false); /** * Disables the stencil buffer */ - void discardMask(); + void discardStencil(); /** * Creates an Image object with padding and/or optimization. diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 60ed515c8..3187e4eab 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -157,7 +157,7 @@ namespace opengl return instance->getScissor(L); } - int w_newMask(lua_State * L) + int w_newStencil(lua_State * L) { // just return the function if (!lua_isfunction(L, 1)) @@ -166,32 +166,32 @@ namespace opengl return 1; } - static int setMask(lua_State * L, bool invert) + static int setStencil(lua_State * L, bool invert) { // no argument -> clear mask if (lua_isnoneornil(L, 1)) { - instance->discardMask(); + instance->discardStencil(); return 0; } if (!lua_isfunction(L, 1)) return luaL_typerror(L, 1, "mask"); - instance->defineMask(); + instance->defineStencil(); lua_call(L, lua_gettop(L) - 1, 0); // call mask(...) - instance->useMask(invert); + instance->useStencil(invert); return 0; } - int w_setMask(lua_State * L) + int w_setStencil(lua_State * L) { - return setMask(L, false); + return setStencil(L, false); } - int w_setInvertedMask(lua_State * L) + int w_setInvertedStencil(lua_State * L) { - return setMask(L, true); + return setStencil(L, true); } int w_newImage(lua_State * L) @@ -1192,9 +1192,9 @@ namespace opengl { "setScissor", w_setScissor }, { "getScissor", w_getScissor }, - { "newMask", w_newMask }, - { "setMask", w_setMask }, - { "setInvertedMask", w_setInvertedMask }, + { "newStencil", w_newStencil }, + { "setStencil", w_setStencil }, + { "setInvertedStencil", w_setInvertedStencil }, { "point", w_point }, { "line", w_line },