Changeset 161 for trunk/tests
- Timestamp:
- 07/15/13 02:48:06 (12 years ago)
- Location:
- trunk/tests
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/cachebuf_test/cachebuf.vert
r102 r161 1 1 #version 120 2 attribute vec2 coord;3 attribute vec4 color;4 uniform mat4 projection;2 attribute vec2 nv_position; 3 attribute vec4 nv_color; 4 uniform mat4 nv_projection; 5 5 varying vec4 f_color; 6 6 7 7 void 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 ); 10 10 } -
trunk/tests/cachebuf_test/nv_cachebuf_test.cc
r152 r161 234 234 nv::vertex_array* m_va; 235 235 unsigned int m_count; 236 int m_coord_loc;237 int m_color_loc;238 236 }; 239 237 … … 257 255 { 258 256 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();261 257 m_va = m_device->create_vertex_array(); 262 258 … … 270 266 #endif 271 267 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 ); 274 270 } 275 271 return true; … … 281 277 m_program->bind(); 282 278 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) ); 284 280 285 281 while(!keypress) … … 297 293 nv::vertex_buffer* buffer = (nv::vertex_buffer*)m_quad_cache->get_buffer(); 298 294 #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 ); 301 297 } 302 298 -
trunk/tests/gui_test/gui.frag
r127 r161 1 1 #version 120 2 varying vec4 f_color;3 varying vec2 f_tcoord;2 varying vec4 v_color; 3 varying vec2 v_texcoord; 4 4 uniform sampler2D tex; 5 5 6 6 void 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; 9 9 } -
trunk/tests/gui_test/gui.vert
r127 r161 1 1 #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;2 attribute vec2 nv_position; 3 attribute vec2 nv_texcoord; 4 attribute vec4 nv_color; 5 uniform mat4 nv_projection; 6 varying vec4 v_color; 7 varying vec2 v_texcoord; 8 8 9 9 void 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 ); 13 13 } -
trunk/tests/objload_test/obj.vert
r139 r161 1 1 #version 120 2 2 3 attribute vec3 position;4 attribute vec2 texcoord;5 attribute vec3 n ormal;3 attribute vec3 nv_position; 4 attribute vec2 nv_texcoord; 5 attribute vec3 nv_normal; 6 6 7 7 varying vec3 v_normal; … … 17 17 18 18 void main(void) { 19 vec4 vertex = vec4( position, 1.0 );19 vec4 vertex = vec4( nv_position, 1.0 ); 20 20 vec3 eye_pos = vec3( nv_m_modelview * vertex ); 21 v_normal = normalize( nv_m_normal * n ormal );21 v_normal = normalize( nv_m_normal * nv_normal ); 22 22 v_light_vector = vec3( normalize( light_position - eye_pos ) ); 23 23 v_view_vector = vec3( normalize( -eye_pos ) ); 24 24 25 v_texcoord = texcoord;25 v_texcoord = nv_texcoord; 26 26 gl_Position = matrix_mvp * vertex; 27 27 }
Note: See TracChangeset
for help on using the changeset viewer.