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.
This commit is contained in:
@@ -83,6 +83,10 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
|
||||
|
||||
_maxTexturePoolSize = vs._maxTexturePoolSize;
|
||||
_maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize;
|
||||
|
||||
_glContextVersion = vs._glContextVersion;
|
||||
_glContextFlags = vs._glContextFlags;
|
||||
_glContextProfileMask = vs._glContextProfileMask;
|
||||
}
|
||||
|
||||
void DisplaySettings::merge(const DisplaySettings& vs)
|
||||
@@ -156,6 +160,10 @@ void DisplaySettings::setDefaults()
|
||||
|
||||
_maxTexturePoolSize = 0;
|
||||
_maxBufferObjectPoolSize = 0;
|
||||
|
||||
_glContextVersion = "1.0";
|
||||
_glContextFlags = 0;
|
||||
_glContextProfileMask = 0;
|
||||
}
|
||||
|
||||
void DisplaySettings::setMaxNumberOfGraphicsContexts(unsigned int num)
|
||||
@@ -198,6 +206,9 @@ static ApplicationUsageProxy DisplaySetting_e17(ApplicationUsage::ENVIRONMENTAL_
|
||||
static ApplicationUsageProxy DisplaySetting_e18(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_TEXTURE_POOL_SIZE <int>","Set the hint size of texture pool to manage.");
|
||||
static ApplicationUsageProxy DisplaySetting_e19(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_BUFFER_OBJECT_POOL_SIZE <int>","Set the hint size of vertex buffer object pool to manage.");
|
||||
static ApplicationUsageProxy DisplaySetting_e20(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_FBO_POOL_SIZE <int>","Set the hint size of frame buffer object pool to manage.");
|
||||
static ApplicationUsageProxy DisplaySetting_e21(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_CONTEXT_VERSION <major.minor>","Set the hint for the GL version to create contexts for.");
|
||||
static ApplicationUsageProxy DisplaySetting_e22(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_CONTEXT_FLAGS <uint>","Set the hint for the GL context flags to use when creating contexts.");
|
||||
static 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.");
|
||||
|
||||
void DisplaySettings::readEnvironmentalVariables()
|
||||
{
|
||||
@@ -404,6 +415,21 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
{
|
||||
_maxBufferObjectPoolSize = atoi(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_GL_VERSION")) != 0 || (ptr = getenv("OSG_GL_CONTEXT_VERSION")) != 0)
|
||||
{
|
||||
_glContextVersion = ptr;
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_GL_CONTEXT_FLAGS")) != 0)
|
||||
{
|
||||
_glContextFlags = atoi(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_GL_CONTEXT_PROFILE_MASK")) != 0)
|
||||
{
|
||||
_glContextProfileMask = atoi(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
@@ -423,6 +449,9 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--samples <num>","Request a multisample visual");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--cc","Request use of compile contexts and threads");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--serialize-draw <mode>","OFF | ON - set the serialization of draw dispatch");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--gl-version <major.minor>","Set the hint of which GL version to use when creating graphics contexts.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--gl-flags <mask>","Set the hint of which GL flags projfile mask to use when creating graphics contexts.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--gl-profile-mask <mask>","Set the hint of which GL context profile mask to use when creating graphics contexts.");
|
||||
}
|
||||
|
||||
std::string str;
|
||||
@@ -494,6 +523,10 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
while(arguments.read("--texture-pool-size",_maxTexturePoolSize)) {}
|
||||
while(arguments.read("--buffer-object-pool-size",_maxBufferObjectPoolSize)) {}
|
||||
|
||||
while (arguments.read("--gl-version", _glContextVersion)) {}
|
||||
while (arguments.read("--gl-flags", _glContextFlags)) {}
|
||||
while (arguments.read("--gl-profile-mask", _glContextProfileMask)) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user