Use automatic batching for love.graphics.print/printf.

This doesn’t actually improve performance at all in most cases, but it does remove some OpenGL-specific code from the Font files, and reduces the amount of duplicated rendering code. This makes it slightly easier to add support for Core Profile OpenGL 3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-12-29 00:25:14 -04:00
parent 52b7b0f80d
commit 4a3889ae48
8 changed files with 116 additions and 113 deletions
+6 -3
View File
@@ -468,7 +468,10 @@ void Graphics::flushStreamDraws()
gl.prepareDraw();
gl.bindTextureToUnit(sbstate.texture, 0, false);
if (sbstate.textureHandle != 0)
gl.bindTextureToUnit((GLuint) sbstate.textureHandle, 0, false);
else
gl.bindTextureToUnit(sbstate.texture, 0, false);
gl.useVertexAttribArrays(attribs);
@@ -1730,7 +1733,7 @@ void Graphics::print(const std::vector<Font::ColoredString> &str, const Matrix4
DisplayState &state = states.back();
if (state.font.get() != nullptr)
state.font->print(str, m);
state.font->print(this, str, m, state.color);
}
void Graphics::printf(const std::vector<Font::ColoredString> &str, float wrap, Font::AlignMode align, const Matrix4 &m)
@@ -1740,7 +1743,7 @@ void Graphics::printf(const std::vector<Font::ColoredString> &str, float wrap, F
DisplayState &state = states.back();
if (state.font.get() != nullptr)
state.font->printf(str, wrap, align, m);
state.font->printf(this, str, wrap, align, m, state.color);
}
/**