Changeset 160 for trunk


Ignore:
Timestamp:
07/15/13 00:34:53 (12 years ago)
Author:
epyon
Message:
  • gl.hh - added GL_GENERATE_MIPMAP (deprecated in GL 3.0, but substitute glGenerateMipmaps not available pre GL 3.0)
  • gl_texture2d - mipmaps will be automatically generated if any of the mipmap dependent sampler parameters is used
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/lib/gl.hh

    r37 r160  
    363363
    364364/* OpenGL 1.4 non-deprecated defines */
     365// this one is actually deprecated, but the method glGenerateMipmap isn't available yet in 2.1
     366#define GL_GENERATE_MIPMAP 0x8191
    365367#define GL_BLEND_DST_RGB 0x80C8
    366368#define GL_BLEND_SRC_RGB 0x80C9
  • trunk/src/gl/gl_texture2d.cc

    r121 r160  
    1414{
    1515        glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
     16
     17        // Detect if mipmapping was requested
     18        if (( asampler.filter_min != sampler::LINEAR && asampler.filter_min != sampler::NEAREST ) ||
     19                ( asampler.filter_max != sampler::LINEAR && asampler.filter_max != sampler::NEAREST ))
     20        {
     21                glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
     22        }
    1623
    1724        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_min ) );
Note: See TracChangeset for help on using the changeset viewer.