X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_os_osgviewer.cxx;h=b58d60664ba7cacc5fd3b1500868d9f5aa4b8b35;hb=571f7301f2b0b493f90769baa0728f82fa8ea731;hp=8badbd6d1418c00b329cd8b2fb14405134dabb3d;hpb=157eb857ef36636a316947fe1eb3d9a8bea1959b;p=flightgear.git diff --git a/src/Main/fg_os_osgviewer.cxx b/src/Main/fg_os_osgviewer.cxx index 8badbd6d1..b58d60664 100644 --- a/src/Main/fg_os_osgviewer.cxx +++ b/src/Main/fg_os_osgviewer.cxx @@ -59,8 +59,33 @@ #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 +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 +104,6 @@ static osg::ref_ptr 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 +192,8 @@ void fgOSMainLoop() ref_ptr 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 +226,6 @@ void fgOSFullScreen() { } -#ifdef OSG_HAS_MOUSE_CURSOR_PATCH static void setMouseCursor(osg::Camera* camera, int cursor) { if (!camera) @@ -246,18 +269,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()