Changeset 73 for trunk/tests/render_test/rl.cc
- Timestamp:
- 06/01/13 01:26:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/render_test/rl.cc
r71 r73 66 66 application(); 67 67 bool initialize(); 68 bool init_program( const std::string& name, nv::program*& p, nv::vertex_array*& va, nv::mesh* m );69 68 bool run(); 70 69 ~application(); … … 117 116 vtx.emplace_back( x, h, y ); 118 117 mat.insert( mat.end(), 6, nv::i8vec3( m, 1, 0 ) ); 119 120 if (!init_program( "char", m_char_program, m_char_va, &cmesh ) ) return false;118 m_char_program = m_device->create_program( nv::slurp( "char.vert" ), nv::slurp( "char.frag" ) ); 119 m_char_va = m_device->create_vertex_array( &cmesh, &(m_char_program->get_attributes()), nv::STATIC_DRAW ); 121 120 } 122 121 … … 175 174 } 176 175 177 m_count = vtx.size(); 178 if (!init_program( "box", m_box_program, m_box_va, &wmesh ) ) return false; 179 } 180 181 return true; 182 } 183 184 bool application::init_program( const std::string& name, nv::program*& p, nv::vertex_array*& va, nv::mesh* m ) 185 { 186 p = m_device->create_program( nv::slurp( name+".vert" ), nv::slurp( name+".frag" ) ); 187 va = m_device->create_vertex_array(); 188 const nv::mesh::map& attrs = m->get_attributes(); 189 190 for ( auto attr : attrs ) 191 { 192 nv::vertex_buffer* vb = m_device->create_vertex_buffer( nv::STATIC_DRAW, attr.second->get_size(), attr.second->get_data() ); 193 va->add_vertex_buffer( p->get_attribute( attr.first )->get_location(), vb, attr.second->get_base_type(), attr.second->get_components() ); 194 } 176 m_count = vtx.size(); 177 m_box_program = m_device->create_program( nv::slurp( "box.vert" ), nv::slurp( "box.frag" ) ); 178 m_box_va = m_device->create_vertex_array( &wmesh, &(m_box_program->get_attributes()), nv::STATIC_DRAW ); 179 } 180 195 181 return true; 196 182 }
Note: See TracChangeset
for help on using the changeset viewer.