Fixed Geometry:flip when the Geometry was created with newQuad (resolves issue #671)

This commit is contained in:
Alex Szpakowski
2013-07-11 16:09:41 -03:00
parent 882313551c
commit 267d901cd6
4 changed files with 18 additions and 9 deletions
@@ -246,6 +246,7 @@
FA636D8B171B70920065623F /* RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA636D89171B70920065623F /* RandomGenerator.h */; }; FA636D8B171B70920065623F /* RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA636D89171B70920065623F /* RandomGenerator.h */; };
FA636D8E171B72A70065623F /* wrap_RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA636D8C171B72A70065623F /* wrap_RandomGenerator.cpp */; }; FA636D8E171B72A70065623F /* wrap_RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA636D8C171B72A70065623F /* wrap_RandomGenerator.cpp */; };
FA636D8F171B72A70065623F /* wrap_RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA636D8D171B72A70065623F /* wrap_RandomGenerator.h */; }; FA636D8F171B72A70065623F /* wrap_RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA636D8D171B72A70065623F /* wrap_RandomGenerator.h */; };
FA7175AA178E8418001FE7FE /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7175A9178E8418001FE7FE /* lua.h */; };
FA7C937A16DCC6C2006F2BEE /* wrap_Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA7C937516DCC6C2006F2BEE /* wrap_Math.cpp */; }; FA7C937A16DCC6C2006F2BEE /* wrap_Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA7C937516DCC6C2006F2BEE /* wrap_Math.cpp */; };
FA7C937B16DCC6C2006F2BEE /* wrap_Math.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7C937616DCC6C2006F2BEE /* wrap_Math.h */; }; FA7C937B16DCC6C2006F2BEE /* wrap_Math.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7C937616DCC6C2006F2BEE /* wrap_Math.h */; };
FA9FC0B0173D6E3E005027FF /* wrap_Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9FC0AE173D6E3E005027FF /* wrap_Window.cpp */; }; FA9FC0B0173D6E3E005027FF /* wrap_Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9FC0AE173D6E3E005027FF /* wrap_Window.cpp */; };
@@ -767,6 +768,7 @@
FA636D89171B70920065623F /* RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomGenerator.h; sourceTree = "<group>"; }; FA636D89171B70920065623F /* RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomGenerator.h; sourceTree = "<group>"; };
FA636D8C171B72A70065623F /* wrap_RandomGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RandomGenerator.cpp; sourceTree = "<group>"; }; FA636D8C171B72A70065623F /* wrap_RandomGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RandomGenerator.cpp; sourceTree = "<group>"; };
FA636D8D171B72A70065623F /* wrap_RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RandomGenerator.h; sourceTree = "<group>"; }; FA636D8D171B72A70065623F /* wrap_RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RandomGenerator.h; sourceTree = "<group>"; };
FA7175A9178E8418001FE7FE /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua.h; sourceTree = "<group>"; };
FA7C937516DCC6C2006F2BEE /* wrap_Math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Math.cpp; sourceTree = "<group>"; }; FA7C937516DCC6C2006F2BEE /* wrap_Math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Math.cpp; sourceTree = "<group>"; };
FA7C937616DCC6C2006F2BEE /* wrap_Math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Math.h; sourceTree = "<group>"; }; FA7C937616DCC6C2006F2BEE /* wrap_Math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Math.h; sourceTree = "<group>"; };
FA9FC0AE173D6E3E005027FF /* wrap_Window.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Window.cpp; sourceTree = "<group>"; }; FA9FC0AE173D6E3E005027FF /* wrap_Window.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Window.cpp; sourceTree = "<group>"; };
@@ -960,6 +962,7 @@
1350109F709C227D4AFD423C /* libluasocket */ = { 1350109F709C227D4AFD423C /* libluasocket */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FA7175A9178E8418001FE7FE /* lua.h */,
1CD02D1975803957282F28AB /* auxiliar.c */, 1CD02D1975803957282F28AB /* auxiliar.c */,
1F6F652A57F8098E5CCA6F9A /* auxiliar.h */, 1F6F652A57F8098E5CCA6F9A /* auxiliar.h */,
21B25A7E333315172B754D4F /* buffer.c */, 21B25A7E333315172B754D4F /* buffer.c */,
@@ -1858,6 +1861,7 @@
FA5FDC851788D548002F0ED2 /* utility.h in Headers */, FA5FDC851788D548002F0ED2 /* utility.h in Headers */,
FA5FDC861788D548002F0ED2 /* win32.h in Headers */, FA5FDC861788D548002F0ED2 /* win32.h in Headers */,
FA5FDC8F1788D548002F0ED2 /* lua-enet.h in Headers */, FA5FDC8F1788D548002F0ED2 /* lua-enet.h in Headers */,
FA7175AA178E8418001FE7FE /* lua.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
+4 -4
View File
@@ -77,10 +77,10 @@ Geometry::Geometry(float x, float y, float w, float h, float sw, float sh)
, vertexCount(4) , vertexCount(4)
, elementArray(NULL) , elementArray(NULL)
, elementCount(0) , elementCount(0)
, x_min(x) , x_min(0)
, x_max(x+w) , x_max(w)
, y_min(y) , y_min(0)
, y_max(y+h) , y_max(h)
, vertexColors(false) , vertexColors(false)
, drawMode(DRAW_MODE_FAN) , drawMode(DRAW_MODE_FAN)
{ {
+9 -4
View File
@@ -184,6 +184,7 @@ void Shader::createProgram(const std::vector<GLuint> &shaderids)
{ {
std::string warnings = getProgramWarnings(); std::string warnings = getProgramWarnings();
glDeleteProgram(program); glDeleteProgram(program);
program = 0;
throw love::Exception("Cannot link shader program object:\n%s", warnings.c_str()); throw love::Exception("Cannot link shader program object:\n%s", warnings.c_str());
} }
@@ -265,9 +266,10 @@ void Shader::unloadVolatile()
glUseProgram(0); glUseProgram(0);
if (program != 0) if (program != 0)
{
glDeleteProgram(program); glDeleteProgram(program);
program = 0;
program = 0; }
// decrement global texture id counters for texture units which had textures bound from this shader // decrement global texture id counters for texture units which had textures bound from this shader
for (size_t i = 0; i < activeTextureUnits.size(); ++i) for (size_t i = 0; i < activeTextureUnits.size(); ++i)
@@ -324,9 +326,10 @@ std::string Shader::getWarnings() const
void Shader::attach(bool temporary) void Shader::attach(bool temporary)
{ {
if (current != this) if (current != this)
{
glUseProgram(program); glUseProgram(program);
current = this;
current = this; }
if (!temporary) if (!temporary)
{ {
@@ -337,6 +340,8 @@ void Shader::attach(bool temporary)
if (activeTextureUnits[i] > 0) if (activeTextureUnits[i] > 0)
gl.bindTextureToUnit(activeTextureUnits[i], i + 1, false); gl.bindTextureToUnit(activeTextureUnits[i], i + 1, false);
} }
// We always want to use texture unit 0 for everyhing else.
gl.setActiveTextureUnit(0); gl.setActiveTextureUnit(0);
} }
} }
@@ -319,7 +319,7 @@ int w_newGeometry(lua_State *L)
{ {
lua_rawgeti(L, 1, i+1); lua_rawgeti(L, 1, i+1);
if (!lua_istable(L, -1)) if (!lua_istable(L, -1))
return luaL_typerror(L, 1, "table of tables"); return luax_typerror(L, 1, "table of tables");
} }
else else
{ {