]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/text.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / render / text.cpp
index b43061c522a5addbbf2ff474742efd97fb78fbef..a51d2cf16778a82bc3778c47203a618f39b5cc91 100644 (file)
@@ -1,6 +1,7 @@
 #include "meshbuilder.h"
 #include "program.h"
 #include "renderer.h"
+#include "technique.h"
 #include "text.h"
 #include "texture2d.h"
 
@@ -12,10 +13,7 @@ namespace GL {
 Text::Text(const Font &f, const Technique *tech, Tag tex_slot):
        ObjectInstance(object),
        font(f),
-       mesh((TEXCOORD2, VERTEX2)),
-       horz_align(0.0f),
-       vert_offset(0.0f),
-       width(0.0f)
+       mesh((TEXCOORD2, VERTEX2))
 {
        object.set_mesh(&mesh);
        if(tech)
@@ -26,8 +24,8 @@ void Text::set_technique(const Technique *tech, Tag tex_slot)
 {
        if(tech)
        {
-               if(!tex_slot.id && tech->has_pass(Tag()))
-                       if(const Program *shprog = tech->get_pass(Tag()).get_shader_program())
+               if(!tex_slot.id && tech->has_method(Tag()))
+                       if(const Program *shprog = tech->get_method(Tag()).get_shader_program())
                        {
                                if(shprog->get_uniform_location(Tag("font_tex"))>=0)
                                        tex_slot = "font_tex";
@@ -102,7 +100,7 @@ void Text::set_alignment(float h, float v)
        unsigned n_vertices = mesh.get_n_vertices();
        for(unsigned i=0; i<n_vertices; ++i)
        {
-               float *pos = mesh.modify_vertex(i)+pos_offset;
+               float *pos = reinterpret_cast<float *>(mesh.modify_vertex(i)+pos_offset);
                pos[0] += horz_adjust;
                pos[1] += vert_adjust;
        }