- Timestamp:
- 05/06/14 04:59:23 (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/lib/detail/gl_functions.inc
r167 r229 179 179 NV_GL_FUN_EXT( void , glUniformMatrix3x4fv , ( GLint , GLsizei , GLboolean , const GLfloat *) ); 180 180 NV_GL_FUN_EXT( void , glUniformMatrix4x3fv , ( GLint , GLsizei , GLboolean , const GLfloat *) ); 181 182 /* GL_EXT_FRAMEBUFFER */ 183 NV_GL_FUN_EXT( void , glBindFramebuffer , ( GLenum , GLuint ) ); 184 NV_GL_FUN_EXT( void , glBindRenderbuffer , ( GLenum , GLuint ) ); 185 NV_GL_FUN_EXT( GLenum , glCheckFramebufferStatus , ( GLenum ) ); 186 NV_GL_FUN_EXT( void , glDeleteFramebuffers , ( GLsizei , const GLuint*) ); 187 NV_GL_FUN_EXT( void , glDeleteRenderbuffers , ( GLsizei , const GLuint*) ); 188 NV_GL_FUN_EXT( void , glFramebufferRenderbuffer , ( GLenum , GLenum , GLenum , GLuint ) ); 189 NV_GL_FUN_EXT( void , glFramebufferTexture1D , ( GLenum , GLenum , GLenum , GLuint , GLint ) ); 190 NV_GL_FUN_EXT( void , glFramebufferTexture2D , ( GLenum , GLenum , GLenum , GLuint , GLint ) ); 191 NV_GL_FUN_EXT( void , glFramebufferTexture3D , ( GLenum , GLenum , GLenum , GLuint , GLint , GLint ) ); 192 NV_GL_FUN_EXT( void , glGenFramebuffers , ( GLsizei , GLuint* ) ); 193 NV_GL_FUN_EXT( void , glGenRenderbuffers , ( GLsizei , GLuint* ) ); 194 NV_GL_FUN_EXT( void , glGenerateMipmap , ( GLenum ) ); 195 NV_GL_FUN_EXT( void , glGetFramebufferAttachmentParameteriv , ( GLenum , GLenum , GLenum , GLint* ) ); 196 NV_GL_FUN_EXT( void , glGetRenderbufferParameteriv , ( GLenum , GLenum , GLint* ) ); 197 NV_GL_FUN_EXT( GLboolean , glIsFramebuffer , ( GLuint ) ); 198 NV_GL_FUN_EXT( GLboolean , glIsRenderbuffer , ( GLuint ) ); 199 NV_GL_FUN_EXT( void , glRenderbufferStorage , ( GLenum , GLenum , GLsizei , GLsizei ) ); 200 // NV_GL_FUN_EXT( void , glBlitFramebuffer , ( GLint , GLint , GLint , GLint , GLint , GLint , GLint , GLint , GLbitfield , GLenum ) ); 201 // NV_GL_FUN_EXT( void , glFramebufferTextureLayer , ( GLenum , GLenum , GLuint , GLint , GLint ) ); 202 // NV_GL_FUN_EXT( void , glRenderbufferStorageMultisample , ( GLenum , GLsizei , GLenum , GLsizei , GLsizei ) ); 203 204 -
trunk/nv/lib/gl.hh
r167 r229 503 503 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 504 504 505 /* GL_EXT_FRAMEBUFFER */ 506 /* We brutally force loading of the extension. Later, probably we'd need a runtime check for this */ 507 /* TODO: do it the nice way */ 508 #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 509 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 510 #define GL_FRAMEBUFFER_BINDING 0x8CA6 511 #define GL_RENDERBUFFER_BINDING 0x8CA7 512 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 513 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 514 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 515 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 516 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET 0x8CD4 517 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5 518 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 519 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 520 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 521 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA 522 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB 523 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC 524 #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD 525 #define GL_MAX_COLOR_ATTACHMENTS 0x8CDF 526 #define GL_COLOR_ATTACHMENT0 0x8CE0 527 #define GL_COLOR_ATTACHMENT1 0x8CE1 528 #define GL_COLOR_ATTACHMENT2 0x8CE2 529 #define GL_COLOR_ATTACHMENT3 0x8CE3 530 #define GL_COLOR_ATTACHMENT4 0x8CE4 531 #define GL_COLOR_ATTACHMENT5 0x8CE5 532 #define GL_COLOR_ATTACHMENT6 0x8CE6 533 #define GL_COLOR_ATTACHMENT7 0x8CE7 534 #define GL_COLOR_ATTACHMENT8 0x8CE8 535 #define GL_COLOR_ATTACHMENT9 0x8CE9 536 #define GL_COLOR_ATTACHMENT10 0x8CEA 537 #define GL_COLOR_ATTACHMENT11 0x8CEB 538 #define GL_COLOR_ATTACHMENT12 0x8CEC 539 #define GL_COLOR_ATTACHMENT13 0x8CED 540 #define GL_COLOR_ATTACHMENT14 0x8CEE 541 #define GL_COLOR_ATTACHMENT15 0x8CEF 542 #define GL_DEPTH_ATTACHMENT 0x8D00 543 #define GL_STENCIL_ATTACHMENT 0x8D20 544 #define GL_FRAMEBUFFER 0x8D40 545 #define GL_RENDERBUFFER 0x8D41 546 #define GL_RENDERBUFFER_WIDTH 0x8D42 547 #define GL_RENDERBUFFER_HEIGHT 0x8D43 548 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 549 #define GL_STENCIL_INDEX1 0x8D46 550 #define GL_STENCIL_INDEX4 0x8D47 551 #define GL_STENCIL_INDEX8 0x8D48 552 #define GL_STENCIL_INDEX16 0x8D49 553 #define GL_RENDERBUFFER_RED_SIZE 0x8D50 554 #define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 555 #define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 556 #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 557 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 558 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 559 560 561 505 562 #if defined(NV_GL_DYNAMIC) 506 563 # define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *fname) fparams -
trunk/nv/math.hh
r214 r229 19 19 #include <glm/gtc/matrix_transform.hpp> 20 20 #include <glm/gtc/type_ptr.hpp> 21 #include <glm/gtc/quaternion.hpp> 21 22 22 23 namespace nv -
trunk/nv/resource.hh
r121 r229 23 23 { 24 24 public: 25 typedef std::shared_ptr< resource > ptr; 26 public: 25 resource() : m_size(0), m_rid(0), m_used(0), m_loaded(0), m_data(nullptr) {} 27 26 virtual bool load() = 0; 27 virtual bool initialize() { return true; }; 28 virtual bool destroy() { return true; }; 28 29 virtual bool unload() = 0; 29 30 bool is_loaded() const { return m_loaded; } 30 31 uid get_rid() const { return m_rid; } 31 32 uid get_size() const { return m_size; } 33 const void* get() { return m_data; } 34 void lock() { m_used++; } 35 void unlock() { m_used--; } 32 36 virtual ~resource() {} 33 37 private: 34 38 uint32 m_size; 35 39 uint32 m_rid; 40 uint32 m_used; 36 41 bool m_loaded; 42 void* m_data; 43 }; 44 45 template< class DATA > 46 class resource_type : public resource 47 { 48 public: 49 explicit resource_type( DATA* data ) : m_data( data ) {} 50 virtual bool load() { return true; }; 51 virtual bool unload() { return true; }; 52 ~resource_type() { delete data; } 53 }; 54 55 56 57 template< class DATA > 58 class resource_handle 59 { 60 public: 61 explicit resource_handle( resource_type< DATA >& m_resource ) 62 : m_resource( &a_resource ) { m_resource.lock(); } 63 void assign( resource_type< DATA >& a_resource ) 64 { 65 m_resource.unlock(); 66 m_resource = a_resource; 67 m_resource.lock(); 68 } 69 const DATA* operator->() const { return (const DATA*)m_resource.get(); } 70 ~resource_handle() { m_resource.unlock(); } 71 private: 72 resource& m_resource; 37 73 }; 38 74 -
trunk/nv/resource_manager.hh
r18 r229 56 56 } 57 57 58 resource ::ptrget_raw_resource(uint32 id) const;59 resource ::ptrget_raw_resource(const std::string& id) const;58 resource* get_raw_resource(uint32 id) const; 59 resource* get_raw_resource(const std::string& id) const; 60 60 61 61 private: 62 typedef std::vector< resource ::ptr> resources;62 typedef std::vector< resource* > resources; 63 63 typedef std::unordered_map< std::string, uid > id_map; 64 64 typedef std::unordered_map< std::string, resource_constructor_func > constructor_map; -
trunk/src/gl/gl_device.cc
r228 r229 49 49 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); 50 50 51 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );52 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 );51 // SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); 52 // SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 ); 53 53 54 54 #if NV_SDL_VERSION == NV_SDL_20 -
trunk/src/resource_manager.cc
r45 r229 14 14 } 15 15 16 resource ::ptrresource_manager::get_raw_resource(uint32 id) const16 resource* resource_manager::get_raw_resource(uint32 id) const 17 17 { 18 18 return m_data[ id ]; 19 19 } 20 20 21 resource ::ptrresource_manager::get_raw_resource(const std::string& id) const21 resource* resource_manager::get_raw_resource(const std::string& id) const 22 22 { 23 23 auto i = m_id_map.find( id ); … … 26 26 return m_data[ (unsigned int)i->second ]; 27 27 } 28 return resource::ptr();28 return nullptr; 29 29 } 30 30 31 void resource_manager::register_resource_type( const std::string& name, resource_constructor_func c )31 void resource_manager::register_resource_type( const std::string& type_name, resource_constructor_func c ) 32 32 { 33 m_constructors[ name ] = c;33 m_constructors[ type_name ] = c; 34 34 } 35 35 -
trunk/tests/gui_test/nv_gui_test.cc
r127 r229 27 27 { 28 28 m_device = new nv::gl_device(); 29 m_window = m_device->create_window( 800, 600 );29 m_window = m_device->create_window( 800, 600, false ); 30 30 m_clear_state.buffers = nv::clear_state::COLOR_AND_DEPTH_BUFFER; 31 31 m_guienv = new nv::gui::environment( m_window );
Note: See TracChangeset
for help on using the changeset viewer.