Changeset 1498


Ignore:
Timestamp:
Jun 18, 2012, 9:30:00 PM (8 years ago)
Author:
sam
Message:

neercs: move texture loading to the TextRender object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/neercs/video/render.cpp

    r1497 r1498  
    4242#define PID M_PI/180.0f    // pi ratio
    4343#define CR 1.0f/256.0f     // color ratio
    44 
    45 bool done = false;
    4644
    4745/*
     
    109107/* common variable */
    110108float value, angle, radius, scale, speed;
    111 TileSet *tex_map;
    112109/* shader variable */
    113110bool shader_flag = true;
    114111bool shader_blur_flag = true;
     112bool shader_glow_flag = true;
    115113bool shader_effect_flag = true;
    116 bool shader_glow_flag = true;
    117114bool shader_postfx_flag = true;
    118 bool shader_radial_flag = false;
    119115
    120116int glow_fbo_size = 2;        // glow fbo size
     
    187183    void Init(ivec2 screen_size)
    188184    {
     185        m_font = new TileSet("neercs/video/resource/map.png",
     186                             ivec2(256, 256), ivec2(1));
     187
    189188        m_shader = Shader::Create(lolfx_text);
    190189        m_coord = m_shader->GetAttribLocation("in_Position",
     
    252251        glPointSize((float)max(m_font_size.x, m_font_size.y));
    253252        m_shader->Bind();
    254         tex_map->Bind();
     253        m_font->Bind();
    255254        m_shader->SetUniform(m_texture, 0);
    256255        m_shader->SetUniform(m_transform, xform);
     
    261260        m_vdecl->DrawElements(MeshPrimitive::Points, 0, m_cells);
    262261        m_vdecl->Unbind();
    263         tex_map->Unbind();
     262        m_font->Unbind();
    264263        m_shader->Unbind();
    265264        glDisable(GL_POINT_SPRITE);
     
    295294
    296295    Array<vec2> m_vertices;
     296    TileSet *m_font;
    297297    Shader *m_shader;
    298298    ShaderAttrib m_coord, m_color, m_char;
     
    360360    glEnable(GL_CULL_FACE);   // disable cull face
    361361    glCullFace(GL_BACK);      // don't draw front face
    362 
    363     // load texture
    364     tex_map = new TileSet("neercs/video/resource/map.png",
    365                           ivec2(256, 256), ivec2(1));
    366362
    367363    if (shader_flag)
     
    551547    glMatrixMode(GL_MODELVIEW);
    552548
    553     tex_map->Bind();
    554549    glEnable(GL_BLEND);
    555550    // draw dos
     
    612607    glDrawArrays(GL_TRIANGLES, 0, corner_n*3);
    613608    glEnable(GL_BLEND);
    614     tex_map->Unbind();
    615609}
    616610
Note: See TracChangeset for help on using the changeset viewer.