Changeset 299 for trunk/src/gl/gl_texture2d.cc
- Timestamp:
- 08/07/14 10:10:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_texture2d.cc
r292 r299 31 31 if (data) 32 32 { 33 assign(data); 33 glBindTexture( GL_TEXTURE_2D, m_name.get_value() ); 34 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 36 } 35 37 } 36 38 37 void nv::gl_texture2d::assign( void* data )38 {39 glBindTexture( GL_TEXTURE_2D, m_name.get_value() );40 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 );41 glBindTexture( GL_TEXTURE_2D, 0 );42 }43 44 void nv::gl_texture2d::bind( size_t slot )45 {46 glActiveTexture( GL_TEXTURE0 + static_cast< GLenum >( slot ) );47 glBindTexture( GL_TEXTURE_2D, m_name.get_value() );48 }49 50 void nv::gl_texture2d::unbind()51 {52 glBindTexture( GL_TEXTURE_2D, 0 );53 }54 55 bool nv::gl_texture2d::is_valid() const56 {57 return m_name.is_valid();58 }
Note: See TracChangeset
for help on using the changeset viewer.