Geometries now automatically use per-vertex colors when drawing if any vertex has a custom color set, otherwise the constant color is used.

Still not a perfect solution, but it works better than before
This commit is contained in:
Alex Szpakowski
2013-04-23 23:25:45 -07:00
parent a5eaffe625
commit 3b05ec0635
7 changed files with 78 additions and 41 deletions
+13 -3
View File
@@ -600,10 +600,20 @@ void Canvas::drawg(love::graphics::Geometry *geom, float x, float y, float angle
}
// use colors stored in geometry (horrible, horrible hack)
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), (GLvoid *)&v->r);
if (geom->hasVertexColors())
{
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), (GLvoid *)&v->r);
}
drawv(t, v, vcount, GL_TRIANGLES);
glDisableClientState(GL_COLOR_ARRAY);
if (geom->hasVertexColors())
{
glDisableClientState(GL_COLOR_ARRAY);
gl.setColor(gl.getColor());
}
delete[] v;
}