Ignore:
Timestamp:
05/15/15 12:01:41 (10 years ago)
Author:
epyon
Message:
  • more string_ref changes
File:
1 edited

Legend:

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

    r350 r361  
    2222}
    2323
    24 program gl_device::create_program( const string& vs_source, const string& fs_source )
     24program gl_device::create_program( string_ref vs_source, string_ref fs_source )
    2525{
    2626        program result = m_programs.create();
     
    3535// this is a temporary function that will be removed once we find a way to
    3636// pass binary file data around
    37 image_data* gl_device::create_image_data( const std::string& filename )
     37image_data* gl_device::create_image_data( string_ref filename )
    3838{
    3939        load_sdl_image_library();
    40         SDL_Surface* image = IMG_Load( filename.c_str() );
     40        SDL_Surface* image = IMG_Load( filename.data() );
    4141        if (!image)
    4242        {
    43                 NV_LOG( LOG_ERROR, "Image file " << filename.c_str() << " not found!" );
     43                NV_LOG( LOG_ERROR, "Image file " << filename << " not found!" );
    4444                return nullptr;
    4545        }
     
    254254}
    255255
    256 bool nv::gl_device::compile( gl_program_info* p, const string& vertex_program, const string& fragment_program )
     256bool nv::gl_device::compile( gl_program_info* p, string_ref vertex_program, string_ref fragment_program )
    257257{
    258258        if (!compile( GL_VERTEX_SHADER,   vertex_program, p->glidv ))   { return false; }
     
    397397}
    398398
    399 bool nv::gl_device::compile( uint32 sh_type, const std::string& shader_code, unsigned& glid )
     399bool nv::gl_device::compile( uint32 sh_type, string_ref shader_code, unsigned& glid )
    400400{
    401401        glid = glCreateShader( sh_type );
    402402
    403         const char* pc = shader_code.c_str();
    404 
    405         glShaderSource( glid,   1, &pc, 0 );
     403        const char* pc = shader_code.data();
     404        int l = shader_code.length();
     405
     406        glShaderSource( glid, 1, &pc, &l );
    406407        glCompileShader( glid );
    407408
Note: See TracChangeset for help on using the changeset viewer.