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
+4 -4
View File
@@ -77,10 +77,10 @@ Geometry::Geometry(float x, float y, float w, float h, float sw, float sh)
, vertexCount(4)
, elementArray(NULL)
, elementCount(0)
, x_min(x)
, x_max(x+w)
, y_min(y)
, y_max(y+h)
, x_min(0)
, x_max(w)
, y_min(0)
, y_max(h)
, vertexColors(false)
, drawMode(DRAW_MODE_FAN)
{
+9 -4
View File
@@ -184,6 +184,7 @@ void Shader::createProgram(const std::vector<GLuint> &shaderids)
{
std::string warnings = getProgramWarnings();
glDeleteProgram(program);
program = 0;
throw love::Exception("Cannot link shader program object:\n%s", warnings.c_str());
}
@@ -265,9 +266,10 @@ void Shader::unloadVolatile()
glUseProgram(0);
if (program != 0)
{
glDeleteProgram(program);
program = 0;
program = 0;
}
// decrement global texture id counters for texture units which had textures bound from this shader
for (size_t i = 0; i < activeTextureUnits.size(); ++i)
@@ -324,9 +326,10 @@ std::string Shader::getWarnings() const
void Shader::attach(bool temporary)
{
if (current != this)
{
glUseProgram(program);
current = this;
current = this;
}
if (!temporary)
{
@@ -337,6 +340,8 @@ void Shader::attach(bool temporary)
if (activeTextureUnits[i] > 0)
gl.bindTextureToUnit(activeTextureUnits[i], i + 1, false);
}
// We always want to use texture unit 0 for everyhing else.
gl.setActiveTextureUnit(0);
}
}
@@ -319,7 +319,7 @@ int w_newGeometry(lua_State *L)
{
lua_rawgeti(L, 1, i+1);
if (!lua_istable(L, -1))
return luaL_typerror(L, 1, "table of tables");
return luax_typerror(L, 1, "table of tables");
}
else
{