Show
Ignore:
Timestamp:
11/11/09 16:25:42 (5 years ago)
Author:
robert
Message:

Added glContexVersion, glContextFlags and glContextProfileMask members to osg::GraphicsContext::Traits to support GL3 graphics context creation.

Moved the handling of DisplaySettings? into Traits constructor.

Added support for s/getGLContextVersion(), s/getGLContextFlags() and s/getGLContextProfileMask() to osg::DisplaySettings?.

Added command line and env var support for setting the GLContextVersion, GLContextFlags and GLContextProfileMask to osg::DisplaySettings?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/DisplaySettings.cpp

    r10601 r10740  
    8484    _maxTexturePoolSize = vs._maxTexturePoolSize; 
    8585    _maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize; 
     86 
     87    _glContextVersion = vs._glContextVersion; 
     88    _glContextFlags = vs._glContextFlags; 
     89    _glContextProfileMask = vs._glContextProfileMask; 
    8690} 
    8791 
     
    157161    _maxTexturePoolSize = 0; 
    158162    _maxBufferObjectPoolSize = 0; 
     163 
     164    _glContextVersion = "1.0"; 
     165    _glContextFlags = 0; 
     166    _glContextProfileMask = 0; 
    159167} 
    160168 
     
    199207static ApplicationUsageProxy DisplaySetting_e19(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_BUFFER_OBJECT_POOL_SIZE <int>","Set the hint size of vertex buffer object pool to manage."); 
    200208static ApplicationUsageProxy DisplaySetting_e20(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_FBO_POOL_SIZE <int>","Set the hint size of frame buffer object pool to manage."); 
     209static ApplicationUsageProxy DisplaySetting_e21(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_CONTEXT_VERSION <major.minor>","Set the hint for the GL version to create contexts for."); 
     210static ApplicationUsageProxy DisplaySetting_e22(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_CONTEXT_FLAGS <uint>","Set the hint for the GL context flags to use when creating contexts."); 
     211static ApplicationUsageProxy DisplaySetting_e23(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_CONTEXT_PROFILE_MASK <uint>","Set the hint for the GL context profile mask to use when creating contexts."); 
    201212 
    202213void DisplaySettings::readEnvironmentalVariables() 
     
    404415    { 
    405416        _maxBufferObjectPoolSize = atoi(ptr); 
     417    } 
     418 
     419    if( (ptr = getenv("OSG_GL_VERSION")) != 0 || (ptr = getenv("OSG_GL_CONTEXT_VERSION")) != 0) 
     420    { 
     421        _glContextVersion = ptr; 
     422    } 
     423 
     424    if( (ptr = getenv("OSG_GL_CONTEXT_FLAGS")) != 0) 
     425    { 
     426        _glContextFlags = atoi(ptr); 
     427    } 
     428 
     429    if( (ptr = getenv("OSG_GL_CONTEXT_PROFILE_MASK")) != 0) 
     430    { 
     431        _glContextProfileMask = atoi(ptr); 
    406432    } 
    407433} 
     
    424450        arguments.getApplicationUsage()->addCommandLineOption("--cc","Request use of compile contexts and threads"); 
    425451        arguments.getApplicationUsage()->addCommandLineOption("--serialize-draw <mode>","OFF | ON - set the serialization of draw dispatch"); 
     452        arguments.getApplicationUsage()->addCommandLineOption("--gl-version <major.minor>","Set the hint of which GL version to use when creating graphics contexts."); 
     453        arguments.getApplicationUsage()->addCommandLineOption("--gl-flags <mask>","Set the hint of which GL flags projfile mask to use when creating graphics contexts."); 
     454        arguments.getApplicationUsage()->addCommandLineOption("--gl-profile-mask <mask>","Set the hint of which GL context profile mask to use when creating graphics contexts."); 
    426455    } 
    427456 
     
    495524    while(arguments.read("--buffer-object-pool-size",_maxBufferObjectPoolSize)) {} 
    496525 
    497 } 
    498  
    499  
    500  
     526    while (arguments.read("--gl-version", _glContextVersion)) {} 
     527    while (arguments.read("--gl-flags", _glContextFlags)) {} 
     528    while (arguments.read("--gl-profile-mask", _glContextProfileMask)) {} 
     529 
     530} 
     531 
     532 
     533