Skip to content

Commit

Permalink
deprecate gl.LineStipple
Browse files Browse the repository at this point in the history
  • Loading branch information
rt committed Feb 20, 2019
1 parent 4ed5ddc commit de50ebc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 53 deletions.
1 change: 1 addition & 0 deletions doc/changelog.txt
Expand Up @@ -68,6 +68,7 @@ Lua:
- remove gl.Shape
- remove gl.EdgeFlag
- remove gl.GetGlobalTex{Names,Coords}
- remove gl.LineStipple
- remove {Unit,Feature}Rendering.{SetPieceList,SetMaterialDisplayLists}
- remove LuaMaterial {pre,post}list handling
- remove 'useCamera' LuaMaterial parameter
Expand Down
55 changes: 3 additions & 52 deletions rts/Lua/LuaOpenGL.cpp
Expand Up @@ -828,10 +828,9 @@ void LuaOpenGL::SetupScreenMatrices()

void LuaOpenGL::RevertScreenMatrices()
{
GL::MatrixMode(GL_TEXTURE);
GL::LoadIdentity();

glSpringMatrix2dSetupPV(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
GL::MatrixMode(GL_TEXTURE ); GL::LoadIdentity();
GL::MatrixMode(GL_PROJECTION); GL::LoadMatrix(CMatrix44f::ClipOrthoProj01(globalRendering->supportClipSpaceControl * 1.0f));
GL::MatrixMode(GL_MODELVIEW ); GL::LoadIdentity();
}


Expand Down Expand Up @@ -2440,54 +2439,6 @@ int LuaOpenGL::StencilOpSeparate(lua_State* L)

/******************************************************************************/

int LuaOpenGL::LineStipple(lua_State* L)
{
CheckDrawingEnabled(L, __func__);

const int args = lua_gettop(L); // number of arguments

if (args == 1) {
if (lua_isstring(L, 1)) { // we're ignoring the string value
const unsigned int stipPat = (0xffff & cmdColors.StipplePattern());
if ((stipPat != 0x0000) && (stipPat != 0xffff)) {
glEnable(GL_LINE_STIPPLE);
lineDrawer.SetupLineStipple();
} else {
glDisable(GL_LINE_STIPPLE);
}
}
else if (lua_isboolean(L, 1)) {
if (lua_toboolean(L, 1)) {
glEnable(GL_LINE_STIPPLE);
} else {
glDisable(GL_LINE_STIPPLE);
}
}
else {
luaL_error(L, "Incorrect arguments to gl.LineStipple()");
}
}
else if (args >= 2) {
GLint factor = (GLint)luaL_checkint(L, 1);
GLushort pattern = (GLushort)luaL_checkint(L, 2);
if ((args >= 3) && lua_isnumber(L, 3)) {
int shift = lua_toint(L, 3);
while (shift < 0) { shift += 16; }
shift = (shift % 16);
unsigned int pat = pattern & 0xFFFF;
pat = pat | (pat << 16);
pattern = pat >> shift;
}
glEnable(GL_LINE_STIPPLE);
glLineStipple(factor, pattern);
}
else {
luaL_error(L, "Incorrect arguments to gl.LineStipple()");
}
return 0;
}


int LuaOpenGL::LineWidth(lua_State* L)
{
const float width = luaL_checkfloat(L, 1);
Expand Down
2 changes: 1 addition & 1 deletion rts/Lua/LuaOpenGL.h
Expand Up @@ -183,7 +183,7 @@ class LuaOpenGL {
static int LogicOp(lua_State* L);
static int Fog(lua_State* L) { return 0; }
static int AlphaTest(lua_State* L);
static int LineStipple(lua_State* L);
static int LineStipple(lua_State* L) { return 0; }
static int Blending(lua_State* L);
static int BlendEquation(lua_State* L);
static int BlendFunc(lua_State* L);
Expand Down

0 comments on commit de50ebc

Please sign in to comment.