]> git.mxchange.org Git - flightgear.git/commitdiff
Realize viewer explicitly
authortimoore <timoore>
Mon, 15 Jun 2009 08:50:56 +0000 (08:50 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 15 Jun 2009 09:25:06 +0000 (11:25 +0200)
The osgViewer needs to be "realized" so that, among other things, threading
will start. This is normally done by osgViewer::run, but we don't call
that.
Don't realize graphics contexts; Let osgViewer code do it. This way
osgViewer::isRealized returns the correct answer.

src/Main/WindowBuilder.cxx
src/Main/fg_os_osgviewer.cxx

index 64b38021d5ff97de9e0113e9825c0da175529fc0..79fff968f98a1b9ccd04b536218cf1dc7ba0ccec 100644 (file)
@@ -196,7 +196,6 @@ GraphicsWindow* WindowBuilder::buildWindow(const SGPropertyNode* winNode)
     if (traitsSet) {
         GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits);
         if (gc) {
-            gc->realize();
             GraphicsWindow* window = WindowSystemAdapter::getWSA()
                 ->registerWindow(gc, traits->windowName);
             if (drawGUI)
@@ -223,7 +222,6 @@ GraphicsWindow* WindowBuilder::getDefaultWindow()
     traits->windowName = "FlightGear";
     GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits);
     if (gc) {
-        gc->realize();
         defaultWindow = WindowSystemAdapter::getWSA()
             ->registerWindow(gc, defaultWindowName);
         return defaultWindow;
index 8badbd6d1418c00b329cd8b2fb14405134dabb3d..058e31469e0fa248a2851b3307ba5cbf4c7b7474 100644 (file)
@@ -170,6 +170,8 @@ void fgOSMainLoop()
     ref_ptr<FGEventHandler> manipulator
         = globals->get_renderer()->getEventHandler();
     viewer->setReleaseContextAtEndOfFrameHint(false);
+    if (!viewer->isRealized())
+        viewer->realize();
     while (!viewer->done()) {
         fgIdleHandler idleFunc = manipulator->getIdleHandler();
         fgDrawHandler drawFunc = manipulator->getDrawHandler();