Changeset 161 for trunk/tests


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
Files:
5 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
  • trunk/tests/gui_test/gui.frag

    r127 r161  
    11#version 120
    2 varying vec4 f_color;
    3 varying vec2 f_tcoord;
     2varying vec4 v_color;
     3varying vec2 v_texcoord;
    44uniform sampler2D tex;
    55 
    66void main(void) {
    7         vec4 texture = texture2D(tex,f_tcoord);
    8         gl_FragColor = f_color * texture;
     7        vec4 texture = texture2D(tex,v_texcoord);
     8        gl_FragColor = v_color * texture;
    99}
  • trunk/tests/gui_test/gui.vert

    r127 r161  
    11#version 120
    2 attribute vec2 coord;
    3 attribute vec2 tcoord;
    4 attribute vec4 color;
    5 uniform mat4 projection;
    6 varying vec4 f_color;
    7 varying vec2 f_tcoord;
     2attribute vec2 nv_position;
     3attribute vec2 nv_texcoord;
     4attribute vec4 nv_color;
     5uniform mat4 nv_projection;
     6varying vec4 v_color;
     7varying vec2 v_texcoord;
    88
    99void main(void) {
    10         f_color  = color;
    11         f_tcoord = tcoord;
    12         gl_Position = projection * vec4( coord.x, coord.y, 0.0, 1.0 );
     10        v_color     = nv_color;
     11        v_texcoord  = nv_texcoord;
     12        gl_Position = nv_projection * vec4( nv_position.x, nv_position.y, 0.0, 1.0 );
    1313}
  • trunk/tests/objload_test/obj.vert

    r139 r161  
    11#version 120
    22
    3 attribute vec3 position;
    4 attribute vec2 texcoord;
    5 attribute vec3 normal;
     3attribute vec3 nv_position;
     4attribute vec2 nv_texcoord;
     5attribute vec3 nv_normal;
    66
    77varying vec3 v_normal;
     
    1717
    1818void main(void) {
    19         vec4 vertex     = vec4( position, 1.0 );
     19        vec4 vertex     = vec4( nv_position, 1.0 );
    2020        vec3 eye_pos    = vec3( nv_m_modelview * vertex );
    21         v_normal        = normalize( nv_m_normal * normal );
     21        v_normal        = normalize( nv_m_normal * nv_normal );
    2222        v_light_vector  = vec3( normalize( light_position - eye_pos ) );
    2323        v_view_vector   = vec3( normalize( -eye_pos ) );
    2424
    25         v_texcoord      = texcoord;
     25        v_texcoord      = nv_texcoord;
    2626        gl_Position     = matrix_mvp * vertex;
    2727}
Note: See TracChangeset for help on using the changeset viewer.