From b8bfaf14b5c68428cf34c0e8514e03cd0614ee5b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 28 Nov 2012 20:29:04 +0200 Subject: [PATCH] Bind the font texture in Text::render --- source/text.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/text.cpp b/source/text.cpp index c6fe129..d80bd17 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "style.h" #include "text.h" @@ -160,6 +161,7 @@ void Text::render(const Part &part, const Geometry &parent, unsigned first_row) if(!style || lines.empty()) return; + const GL::Font *font = style->get_font(); const GL::Color &color = style->get_font_color(); GL::Immediate imm((GL::COLOR4_UBYTE, GL::TEXCOORD2, GL::VERTEX2)); imm.color(color.r, color.g, color.b); @@ -167,6 +169,8 @@ void Text::render(const Part &part, const Geometry &parent, unsigned first_row) RenderData data; data.bld = &imm; + GL::Bind bind_tex(font->get_texture()); + process_lines(part, parent, first_row, data); } @@ -242,7 +246,7 @@ void Text::render_line(unsigned i, const Geometry &rgeom, RenderData &data) cons GL::translate(rgeom.x, rgeom.y, 0); GL::scale_uniform(font->get_default_size()); - font->draw_string(text.substr(line.start, line.length), *data.bld); + font->build_string(text.substr(line.start, line.length), *data.bld); } void Text::coords_to_geom_line(unsigned i, const Geometry &rgeom, CoordsToGeomData &data) const -- 2.43.0