mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Prevent redundant calls to glEnable/DisableVertexAttribArray. This should hopefully fix a performance regression compared to 0.9.2 as well.
This commit is contained in:
@@ -360,31 +360,25 @@ void Image::drawv(const Matrix &t, const Vertex *v)
|
||||
|
||||
gl.bindTexture(texture);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_POS);
|
||||
glEnableVertexAttribArray(ATTRIB_TEXCOORD);
|
||||
gl.useVertexAttribArrays(ATTRIBFLAG_POS | ATTRIBFLAG_TEXCOORD);
|
||||
|
||||
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &v[0].x);
|
||||
glVertexAttribPointer(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &v[0].s);
|
||||
|
||||
gl.prepareDraw();
|
||||
gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glDisableVertexAttribArray(ATTRIB_TEXCOORD);
|
||||
glDisableVertexAttribArray(ATTRIB_POS);
|
||||
}
|
||||
|
||||
void Image::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
|
||||
{
|
||||
Matrix t;
|
||||
t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
|
||||
drawv(t, vertices);
|
||||
}
|
||||
|
||||
void Image::drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
|
||||
{
|
||||
Matrix t;
|
||||
t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
|
||||
drawv(t, quad->getVertices());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user