Added osg::SyncSwapBuffersCallback to include/osg/GraphicsContext and support for enabling it to include/osg/DisplaySettings, and to the Viewer/CompositeViewer::realize() methods.
To enable the sync of swap buffers set the env var OSG_SYNC_SWAP_BUFFERS to ON or 1, to switch off set to OFF or 0. One can also use the --sync command line option for application that pass on command line options to the osg::DisplaySettings::instance(). git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14456 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -218,6 +218,7 @@ void DisplaySettings::setDefaults()
|
||||
_glContextProfileMask = 0;
|
||||
|
||||
_swapMethod = SWAP_DEFAULT;
|
||||
_syncSwapBuffers = 0;
|
||||
|
||||
_keystoneHint = false;
|
||||
|
||||
@@ -630,6 +631,23 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
|
||||
}
|
||||
|
||||
if ((ptr = getenv("OSG_SYNC_SWAP_BUFFERS")) != 0)
|
||||
{
|
||||
if (strcmp(ptr,"OFF")==0)
|
||||
{
|
||||
_syncSwapBuffers = 0;
|
||||
}
|
||||
else
|
||||
if (strcmp(ptr,"ON")==0)
|
||||
{
|
||||
_syncSwapBuffers = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_syncSwapBuffers = atoi(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_KEYSTONE")) != 0)
|
||||
{
|
||||
if (strcmp(ptr,"OFF")==0)
|
||||
@@ -715,6 +733,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--keystone-on","Set the keystone hint to true to tell the viewer to do keystone correction.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--keystone-off","Set the keystone hint to false.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--menubar-behavior <behavior>","Set the menubar behavior (AUTO_HIDE | FORCE_HIDE | FORCE_SHOW)");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--sync","Enable sync of swap buffers");
|
||||
}
|
||||
|
||||
std::string str;
|
||||
@@ -769,6 +788,11 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
_numMultiSamples = atoi(str.c_str());
|
||||
}
|
||||
|
||||
while(arguments.read("--sync"))
|
||||
{
|
||||
_syncSwapBuffers = 1;
|
||||
}
|
||||
|
||||
if (arguments.read("--keystone",str))
|
||||
{
|
||||
_keystoneHint = true;
|
||||
|
||||
Reference in New Issue
Block a user