From Andre Garneau:

* Fix for the aspect ratio not being properly set when screens have
different aspect ratios.
* Minor fix for makeCurrentImplementation being called directly instead of
makeCurrent() causing the owning thread pointer not being tracked
* Fix for osglauncher so that it sets its update text regions to DYNAMIC to
prevent multi-threading issues.
This commit is contained in:
Robert Osfield
2007-02-18 14:21:16 +00:00
parent 9d1e6e107c
commit d8e6436dc1
3 changed files with 17 additions and 21 deletions

View File

@@ -137,11 +137,17 @@ void View::setUpViewAcrossAllScreens()
}
else
{
double translate_x = double(numScreens) - 1.0;
bool firstWindow = true;
for(unsigned int i=0; i<numScreens; ++i, translate_x -= 2.0)
double translate_x = 0.0;
for(unsigned int i=0; i<numScreens; ++i)
{
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(i), width, height);
translate_x += double(width) / (double(height) * aspectRatio);
}
for(unsigned int i=0; i<numScreens; ++i)
{
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(i), width, height);
@@ -175,27 +181,17 @@ void View::setUpViewAcrossAllScreens()
osg::notify(osg::NOTICE)<<" GraphicsWindow has not been created successfully."<<std::endl;
}
if (firstWindow)
{
firstWindow = false;
double newAspectRatio = double(traits->width) / double(traits->height);
double aspectRatioChange = newAspectRatio / aspectRatio;
if (aspectRatioChange != 1.0)
{
_camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0);
}
}
camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
addSlave(camera.get(), osg::Matrixd::translate( translate_x, 0.0, 0.0), osg::Matrixd() );
double newAspectRatio = double(traits->width) / double(traits->height);
double aspectRatioChange = newAspectRatio / aspectRatio;
addSlave(camera.get(), osg::Matrixd::translate( translate_x - aspectRatioChange, 0.0, 0.0) * osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0), osg::Matrixd() );
translate_x -= aspectRatioChange * 2.0;
}
}

View File

@@ -927,7 +927,7 @@ struct ViewerCompileOperation : public osg::Operation
// OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
// osg::notify(osg::NOTICE)<<"Compile "<<context<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;
// context->makeCurrentImplementation();
// context->makeCurrent();
osgUtil::GLObjectsVisitor compileVisitor;
compileVisitor.setState(context->getState());
@@ -990,7 +990,7 @@ Viewer::ThreadingModel Viewer::suggestBestThreadingModel()
int numProcessors = OpenThreads::GetNumberOfProcessors();
if (contexts.size()==1)
{
if (numProcessors==1) return SingleThreaded;