- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 4*sizeof(float), data);
- glVertexPointer(2, GL_FLOAT, 4*sizeof(float), data+2);
+ unsigned n=0;
+ for(GlyphMap::iterator i=glyphs.begin(); i!=glyphs.end(); ++i, ++n)
+ {
+ i->second.index=n;
+ create_glyph_vertices(i->second, *va_builder);
+ }
+}
+
+void Font::create_glyph_vertices(const Glyph &glyph, VertexArrayBuilder &va_builder)
+{
+ va_builder.texcoord(glyph.x1, glyph.y1);
+ va_builder.vertex(glyph.off_x, glyph.off_y);
+ va_builder.texcoord(glyph.x2, glyph.y1);
+ va_builder.vertex(glyph.off_x+glyph.w, glyph.off_y);
+ va_builder.texcoord(glyph.x2, glyph.y2);
+ va_builder.vertex(glyph.off_x+glyph.w, glyph.off_y+glyph.h);
+ va_builder.texcoord(glyph.x1, glyph.y2);
+ va_builder.vertex(glyph.off_x, glyph.off_y+glyph.h);
+}
+
+void Font::prepare_render() const
+{
+ tex->bind();
+ varray.apply();
+ glPushMatrix();