Ignore:
Timestamp:
08/07/14 10:10:24 (11 years ago)
Author:
epyon
Message:
  • all bind and update function for graphics objects are done via context (will simplify directx device, and allow for handles instead of objects)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_texture2d.cc

    r292 r299  
    3131        if (data)
    3232        {
    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 );
    3436        }
    3537}
    3638
    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() const
    56 {
    57         return m_name.is_valid();
    58 }
Note: See TracChangeset for help on using the changeset viewer.