Ignore:
Timestamp:
08/07/14 10:29:34 (11 years ago)
Author:
epyon
Message:
  • removed gl_names - too much bloat for too little gain
File:
1 edited

Legend:

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

    r299 r300  
    1111
    1212nv::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 )
    1414{
    15         glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
     15        glGenTextures( 1, &glid );
     16
     17        glBindTexture( GL_TEXTURE_2D, glid );
    1618
    1719        // Detect if mipmapping was requested
     
    2729        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
    2830
    29         glBindTexture( GL_TEXTURE_2D, 0 );
    30 
    3131        if (data)
    3232        {
    33                 glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
    3433                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
     39nv::gl_texture2d::~gl_texture2d()
     40{
     41        if ( glid != 0 )
     42        {
     43                glDeleteTextures( 1, &glid );
    3644        }
    3745}
Note: See TracChangeset for help on using the changeset viewer.