]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_os_osgviewer.cxx
Remove osgGA/MatrixManipulator include
[flightgear.git] / src / Main / fg_os_osgviewer.cxx
index 8badbd6d1418c00b329cd8b2fb14405134dabb3d..a241e60c30104cde02f7546ff460c8f9afece720 100644 (file)
@@ -45,7 +45,6 @@
 #include <osg/View>
 #include <osgViewer/ViewerEventHandlers>
 #include <osgViewer/Viewer>
-#include <osgGA/MatrixManipulator>
 
 #include <Include/general.hxx>
 #include <Scenery/scenery.hxx>
 #include "WindowBuilder.hxx"
 #include "WindowSystemAdapter.hxx"
 
-#if (FG_OSG_VERSION >= 19008)
-#define OSG_HAS_MOUSE_CURSOR_PATCH
+// Static linking of OSG needs special macros
+#ifdef OSG_LIBRARY_STATIC
+#include <osgDB/Registry>
+USE_GRAPHICSWINDOW();
+// Image formats
+USE_OSGPLUGIN(bmp);
+USE_OSGPLUGIN(dds);
+USE_OSGPLUGIN(hdr);
+USE_OSGPLUGIN(pic);
+USE_OSGPLUGIN(pnm);
+USE_OSGPLUGIN(rgb);
+USE_OSGPLUGIN(tga);
+#ifdef OSG_JPEG_ENABLED
+  USE_OSGPLUGIN(jpeg);
+#endif
+#ifdef OSG_PNG_ENABLED
+  USE_OSGPLUGIN(png);
+#endif
+#ifdef OSG_TIFF_ENABLED
+  USE_OSGPLUGIN(tiff);
+#endif
+// Model formats
+USE_OSGPLUGIN(3ds);
+USE_OSGPLUGIN(ac);
+USE_OSGPLUGIN(ive);
+USE_OSGPLUGIN(osg);
+USE_OSGPLUGIN(txf);
 #endif
 
 // fg_os implementation using OpenSceneGraph's osgViewer::Viewer class
@@ -79,9 +103,6 @@ static osg::ref_ptr<osg::Camera> mainCamera;
 
 void fgOSOpenWindow(bool stencil)
 {
-    osg::GraphicsContext::WindowingSystemInterface* wsi
-        = osg::GraphicsContext::getWindowingSystemInterface();
-
     viewer = new osgViewer::Viewer;
     viewer->setDatabasePager(FGScenery::getPagerSingleton());
     CameraGroup* cameraGroup = 0;
@@ -170,6 +191,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();
@@ -202,7 +225,6 @@ void fgOSFullScreen()
 {
 }
 
-#ifdef OSG_HAS_MOUSE_CURSOR_PATCH
 static void setMouseCursor(osg::Camera* camera, int cursor)
 {
     if (!camera)
@@ -246,18 +268,15 @@ static void setMouseCursor(osg::Camera* camera, int cursor)
 
     gw->setCursor(mouseCursor);
 }
-#endif
 
 static int _cursor = -1;
 
 void fgSetMouseCursor(int cursor)
 {
     _cursor = cursor;
-#ifdef OSG_HAS_MOUSE_CURSOR_PATCH
     setMouseCursor(viewer->getCamera(), cursor);
     for (unsigned i = 0; i < viewer->getNumSlaves(); ++i)
         setMouseCursor(viewer->getSlave(i)._camera.get(), cursor);
-#endif
 }
 
 int fgGetMouseCursor()