Changeset 45
- Timestamp:
- 05/28/13 17:55:52 (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gl/gl_context.hh
r44 r45 22 22 gl_context(); 23 23 virtual void clear( const clear_state& cs ); 24 // temporary 25 virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count ); 24 26 virtual const ivec4& get_viewport(); 25 27 virtual void set_viewport( const ivec4& viewport ); -
trunk/nv/gl/gl_device.hh
r44 r45 26 26 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ); 27 27 virtual vertex_array* create_vertex_array(); 28 virtual texture2d* create_texture2d( ivec2 size, texture2d::format aformat, texture2d::datatype adatatype, texture2d_sampler sampler, void* data = nullptr ); 28 29 virtual ~gl_device(); 29 30 private: -
trunk/nv/gl/gl_enum.hh
r43 r45 17 17 #include <nv/interface/vertex_buffer.hh> 18 18 #include <nv/interface/texture2d.hh> 19 #include <nv/interface/context.hh> 19 20 #include <nv/types.hh> 20 21 … … 35 36 unsigned int texture_filter_to_enum( texture2d_sampler::filter filter ); 36 37 unsigned int texture_wrap_to_enum( texture2d_sampler::wrap wrap ); 38 unsigned int primitive_to_enum( primitive p ); 37 39 38 40 unsigned int type_to_gl_enum( type type ); -
trunk/nv/interface/context.hh
r44 r45 14 14 15 15 #include <nv/common.hh> 16 #include <nv/interface/program.hh> 17 #include <nv/interface/vertex_buffer.hh> 16 18 #include <nv/interface/clear_state.hh> 17 19 #include <nv/interface/render_state.hh> … … 19 21 namespace nv 20 22 { 23 enum primitive 24 { 25 POINTS, 26 LINES, 27 LINE_LOOP, 28 LINE_STRIP, 29 TRIANGLES, 30 TRIANGLE_STRIP, 31 TRIANGLE_FAN 32 }; 33 21 34 class context 22 35 { 23 36 public: 24 37 virtual void clear( const clear_state& cs ) = 0; 38 // temporary 39 virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count ) = 0; 25 40 virtual void apply_render_state( const render_state& state ) = 0; 26 41 virtual const ivec4& get_viewport() = 0; -
trunk/nv/interface/device.hh
r44 r45 16 16 #include <nv/string.hh> 17 17 #include <nv/interface/vertex_buffer.hh> 18 #include <nv/interface/texture2d.hh> 18 19 19 20 namespace nv … … 30 31 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0; 31 32 virtual vertex_array* create_vertex_array() = 0; 33 virtual texture2d* create_texture2d( ivec2 size, texture2d::format aformat, texture2d::datatype adatatype, texture2d_sampler sampler, void* data = nullptr ) = 0; 32 34 }; 33 35 -
trunk/src/gl/gl_context.cc
r44 r45 353 353 force_apply_render_state( m_render_state ); 354 354 } 355 356 void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count ) 357 { 358 apply_render_state( rs ); 359 p->bind(); 360 va->bind(); 361 glDrawArrays( primitive_to_enum(prim), 0, count); 362 va->unbind(); 363 p->unbind(); 364 } -
trunk/src/gl/gl_device.cc
r44 r45 8 8 #include "nv/gl/gl_program.hh" 9 9 #include "nv/gl/gl_vertex_buffer.hh" 10 #include "nv/gl/gl_texture2d.hh" 10 11 #include "nv/logging.hh" 11 12 #include "nv/lib/sdl12.hh" … … 66 67 } 67 68 69 texture2d* gl_device::create_texture2d( ivec2 size, texture2d::format aformat, texture2d::datatype adatatype, texture2d_sampler sampler, void* data /*= nullptr */ ) 70 { 71 return new gl_texture2d( size, aformat, adatatype, sampler, data ); 72 } 73 68 74 gl_device::~gl_device() 69 75 { 70 76 SDL_Quit(); 71 77 } 72 -
trunk/src/gl/gl_enum.cc
r44 r45 181 181 } 182 182 183 unsigned int nv::primitive_to_enum( primitive p ) 184 { 185 switch( p ) 186 { 187 case POINTS : return GL_POINTS; 188 case LINES : return GL_LINES; 189 case LINE_LOOP : return GL_LINE_LOOP; 190 case LINE_STRIP : return GL_LINE_STRIP; 191 case TRIANGLES : return GL_TRIANGLES; 192 case TRIANGLE_STRIP : return GL_TRIANGLE_STRIP; 193 case TRIANGLE_FAN : return GL_TRIANGLE_FAN; 194 default : return 0; // TODO: throw! 195 } 196 } 183 197 184 198 unsigned int nv::type_to_gl_enum( type type ) -
trunk/src/gl/texture_font.cc
r28 r45 55 55 56 56 FT_Size_Metrics metrics = ((FT_Face)(m_rface))->size->metrics; 57 m_ascender = (metrics.ascender >> 6) / 100.0;58 m_descender = ( metrics.descender >> 6) / 100.0;59 m_height = (metrics.height >> 6) / 100.0;60 m_linegap = m_height - m_ascender + m_descender;57 m_ascender = (float)(metrics.ascender >> 6) / 100.0f; 58 m_descender = (float)(metrics.descender >> 6) / 100.0f; 59 m_height = (float)(metrics.height >> 6) / 100.0f; 60 m_linegap = m_height - m_ascender + m_descender; 61 61 } 62 62 -
trunk/src/resource_manager.cc
r7 r45 24 24 if ( i != m_id_map.end() ) 25 25 { 26 return m_data[ i->second ];26 return m_data[ (unsigned int)i->second ]; 27 27 } 28 28 return resource::ptr();
Note: See TracChangeset
for help on using the changeset viewer.