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
Location:
trunk/tests/cachebuf_test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/cachebuf_test/cachebuf.vert

    r102 r161  
    11#version 120
    2 attribute vec2 coord;
    3 attribute vec4 color;
    4 uniform mat4 projection;
     2attribute vec2 nv_position;
     3attribute vec4 nv_color;
     4uniform mat4 nv_projection;
    55varying vec4 f_color;
    66
    77void main(void) {
    8         f_color = color;
    9         gl_Position = projection * vec4( coord.x, coord.y, 0.0, 1.0 );
     8        f_color = nv_color;
     9        gl_Position = nv_projection * vec4( nv_position.x, nv_position.y, 0.0, 1.0 );
    1010}
  • trunk/tests/cachebuf_test/nv_cachebuf_test.cc

    r152 r161  
    234234        nv::vertex_array* m_va;
    235235        unsigned int m_count;
    236         int m_coord_loc;
    237         int m_color_loc;
    238236};
    239237
     
    257255        {
    258256                m_program   = m_device->create_program( nv::slurp( "cachebuf.vert" ), nv::slurp( "cachebuf.frag" ) );
    259                 m_coord_loc = m_program->get_attribute("coord")->get_location();
    260                 m_color_loc = m_program->get_attribute("color")->get_location();
    261257                m_va        = m_device->create_vertex_array();
    262258
     
    270266                #endif
    271267
    272                 m_va->add_vertex_buffer( m_coord_loc, buffer, nv::INT,   2, 0, sizeof( vertex ), false );
    273                 m_va->add_vertex_buffer( m_color_loc, buffer, nv::FLOAT, 4, offset_of( &vertex::color ), sizeof( vertex ), false );
     268                m_va->add_vertex_buffer( nv::slot::POSITION, buffer, nv::INT,   2, 0, sizeof( vertex ), false );
     269                m_va->add_vertex_buffer( nv::slot::COLOR,    buffer, nv::FLOAT, 4, offset_of( &vertex::color ), sizeof( vertex ), false );
    274270        }
    275271        return true;
     
    281277        m_program->bind();
    282278        glm::mat4 projection = glm::ortho( 0.0f, 800.0f, 600.0f, 0.0f, -1.0f, 1.0f );
    283         m_program->set_uniform( "projection", glm::mat4(projection) );
     279        m_program->set_uniform( "nv_projection", glm::mat4(projection) );
    284280
    285281        while(!keypress)
     
    297293                        nv::vertex_buffer* buffer = (nv::vertex_buffer*)m_quad_cache->get_buffer();
    298294                        #endif
    299                         m_va->update_vertex_buffer( m_coord_loc, buffer, false );
    300                         m_va->update_vertex_buffer( m_color_loc, buffer, false );
     295                        m_va->update_vertex_buffer( nv::slot::POSITION, buffer, false );
     296                        m_va->update_vertex_buffer( nv::slot::COLOR,    buffer, false );
    301297                }
    302298
Note: See TracChangeset for help on using the changeset viewer.