From Stephan Huber, "I added a bool to GraphicsContext::Traits to indicate wether to use the
multithreaded-opengl-engine on os x or not. I set its default to false, perhaps other os x users can test this setting with their data/apps, to see if we can enable it by default. I changed also the borderless-window-type, so expos?works correctly."
This commit is contained in:
@@ -75,6 +75,7 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
face(0),
|
||||
mipMapGeneration(false),
|
||||
vsync(true),
|
||||
useMultiThreadedOpenGLEngine(false),
|
||||
useCursor(true),
|
||||
sharedContext(0) {}
|
||||
|
||||
@@ -115,6 +116,9 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
// V-sync
|
||||
bool vsync;
|
||||
|
||||
// use multithreaded OpenGL-engine (OS X only)
|
||||
bool useMultiThreadedOpenGLEngine;
|
||||
|
||||
// enable cursor
|
||||
bool useCursor;
|
||||
|
||||
|
||||
@@ -581,15 +581,16 @@ bool GraphicsWindowCarbon::realizeImplementation()
|
||||
attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute);
|
||||
else
|
||||
attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute) & ~kWindowResizableAttribute;
|
||||
err = CreateNewWindow(kDocumentWindowClass, attr, &bounds, &_window);
|
||||
}
|
||||
else {
|
||||
attr = kWindowStandardHandlerAttribute;
|
||||
else
|
||||
{
|
||||
attr = kWindowNoTitleBarAttribute | kWindowNoShadowAttribute | kWindowStandardHandlerAttribute;
|
||||
if (_traits->supportsResize)
|
||||
attr |= kWindowResizableAttribute;
|
||||
err = CreateNewWindow(kSimpleWindowClass, attr, &bounds, &_window);
|
||||
}
|
||||
|
||||
|
||||
err = CreateNewWindow(kDocumentWindowClass, attr, &bounds, &_window);
|
||||
|
||||
if (err) {
|
||||
osg::notify(osg::WARN) << "GraphicsWindowCarbon::realizeImplementation() failed creating a window: " << err << std::endl;
|
||||
return false;
|
||||
@@ -641,8 +642,7 @@ bool GraphicsWindowCarbon::realizeImplementation()
|
||||
|
||||
makeCurrent();
|
||||
|
||||
// disabling Multi-threaded OpenGL Execution because it slows down rendering, perhaps we should add a new attribute to traits?
|
||||
/*
|
||||
if ((_traits->useMultiThreadedOpenGLEngine) && (OpenThreads::GetNumberOfProcessors() > 1)) {
|
||||
// enable Multi-threaded OpenGL Execution:
|
||||
CGLError cgerr = kCGLNoError;
|
||||
CGLContextObj ctx = CGLGetCurrentContext();
|
||||
@@ -653,7 +653,7 @@ bool GraphicsWindowCarbon::realizeImplementation()
|
||||
{
|
||||
osg::notify(osg::INFO) << "GraphicsWindowCarbon:: Multi-threaded OpenGL Execution not available" << std::endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
aglSetDrawable(_context, GetWindowPort(_window));
|
||||
ShowWindow(_window);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user