From: Mikko Rasa Date: Wed, 28 Nov 2012 18:29:04 +0000 (+0200) Subject: Bind the font texture in Text::render X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b8bfaf14b5c68428cf34c0e8514e03cd0614ee5b;p=libs%2Fgltk.git Bind the font texture in Text::render --- 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