Changeset 300 for trunk/src/gl/gl_texture2d.cc
- Timestamp:
- 08/07/14 10:29:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_texture2d.cc
r299 r300 11 11 12 12 nv::gl_texture2d::gl_texture2d( ivec2 size, pixel_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ ) 13 : texture2d( size, aformat, adatatype, asampler ) , m_name()13 : texture2d( size, aformat, adatatype, asampler ) 14 14 { 15 glBindTexture( GL_TEXTURE_2D, m_name.get_value() ); 15 glGenTextures( 1, &glid ); 16 17 glBindTexture( GL_TEXTURE_2D, glid ); 16 18 17 19 // Detect if mipmapping was requested … … 27 29 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) ); 28 30 29 glBindTexture( GL_TEXTURE_2D, 0 );30 31 31 if (data) 32 32 { 33 glBindTexture( GL_TEXTURE_2D, m_name.get_value() );34 33 glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format.format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format.format), nv::datatype_to_gl_enum(m_format.type), data ); 35 glBindTexture( GL_TEXTURE_2D, 0 ); 34 } 35 36 glBindTexture( GL_TEXTURE_2D, 0 ); 37 } 38 39 nv::gl_texture2d::~gl_texture2d() 40 { 41 if ( glid != 0 ) 42 { 43 glDeleteTextures( 1, &glid ); 36 44 } 37 45 }
Note: See TracChangeset
for help on using the changeset viewer.