Ignore:
Timestamp:
07/15/13 02:48:06 (12 years ago)
Author:
epyon
Message:
  • unified naming of attributes in nv
  • predefined attribute bindings based on unified names
  • unified naming of attributes in all tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/gui_renderer.cc

    r152 r161  
    8181        nv::program*      shader;
    8282        nv::texture2d*    texture;
    83 
    84         int loc_coord;
    85         int loc_color;
    86         int loc_tcoord;
    8783};
    8884
     
    116112        sr->varray     = m_window->get_device()->create_vertex_array();
    117113        sr->shader     = m_window->get_device()->create_program( nv::slurp( "gui.vert" ), nv::slurp( "gui.frag" ) );
    118         sr->loc_coord  = sr->shader->get_attribute("coord")->get_location();
    119         sr->loc_tcoord = sr->shader->get_attribute("tcoord")->get_location();
    120         sr->loc_color  = sr->shader->get_attribute("color")->get_location();
    121114        sr->shader->set_uniform( "tex", 0 );
    122115        glm::mat4 projection = glm::ortho( 0.0f, float( m_window->get_width() ), float( m_window->get_height() ), 0.0f, -1.0f, 1.0f );
    123         sr->shader->set_uniform( "projection", projection );
     116        sr->shader->set_uniform( "nv_projection", projection );
    124117
    125118        vertex_buffer* vb = (vertex_buffer*)sr->buffer.get_buffer();
    126         sr->varray->add_vertex_buffer( sr->loc_coord, vb, nv::INT,   2, 0, sizeof( vertex ), false );
    127         sr->varray->add_vertex_buffer( sr->loc_tcoord, vb, nv::FLOAT, 2, offset_of( &vertex::tcoord ), sizeof( vertex ), false );
    128         sr->varray->add_vertex_buffer( sr->loc_color,  vb, nv::FLOAT, 4, offset_of( &vertex::color ), sizeof( vertex ), false );
     119        sr->varray->add_vertex_buffer( slot::POSITION, vb, nv::INT,   2, 0, sizeof( vertex ), false );
     120        sr->varray->add_vertex_buffer( slot::TEXCOORD, vb, nv::FLOAT, 2, offset_of( &vertex::tcoord ), sizeof( vertex ), false );
     121        sr->varray->add_vertex_buffer( slot::COLOR,    vb, nv::FLOAT, 4, offset_of( &vertex::color ), sizeof( vertex ), false );
    129122
    130123        nv::sampler sampler( nv::sampler::LINEAR, nv::sampler::CLAMP_TO_EDGE );
     
    277270        {
    278271                nv::vertex_buffer* vb = (nv::vertex_buffer*)sr->buffer.get_buffer();
    279                 sr->varray->update_vertex_buffer( sr->loc_coord, vb, false );
    280                 sr->varray->update_vertex_buffer( sr->loc_tcoord, vb, false );
    281                 sr->varray->update_vertex_buffer( sr->loc_color,  vb, false );
     272                sr->varray->update_vertex_buffer( nv::POSITION, vb, false );
     273                sr->varray->update_vertex_buffer( nv::TEXCOORD, vb, false );
     274                sr->varray->update_vertex_buffer( nv::COLOR,    vb, false );
    282275        }
    283276        sr->texture->bind( 0 );
Note: See TracChangeset for help on using the changeset viewer.