diff --git a/VisualStudio/OpenSceneGraph.dsw b/VisualStudio/OpenSceneGraph.dsw index 70f9e470b..2b6769e06 100644 --- a/VisualStudio/OpenSceneGraph.dsw +++ b/VisualStudio/OpenSceneGraph.dsw @@ -504,7 +504,7 @@ Package=<4> Project_Dep_Name Core osgDB End Project Dependency Begin Project Dependency - Project_Dep_Name Core osgProducer + Project_Dep_Name Core osgViewer End Project Dependency Begin Project Dependency Project_Dep_Name Core osgUtil diff --git a/VisualStudio/examples/osgbluemarble/osgbluemarble.dsp b/VisualStudio/examples/osgbluemarble/osgbluemarble.dsp index f5d701511..156b577ca 100644 --- a/VisualStudio/examples/osgbluemarble/osgbluemarble.dsp +++ b/VisualStudio/examples/osgbluemarble/osgbluemarble.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Target_Dir "" MTL=midl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../3rdParty/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe @@ -51,7 +51,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 OpenThreadsWin32.lib producer.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /opt:ref /opt:icf /out:"$(OutDir)/osgbluemarble.exe" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib" +# ADD LINK32 OpenThreadsWin32.lib producer.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /opt:ref /opt:icf /out:"$(OutDir)/osgbluemarble.exe" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib" !ELSEIF "$(CFG)" == "Example osgbluemarble - Win32 Debug" @@ -68,7 +68,7 @@ LINK32=link.exe # PROP Target_Dir "" MTL=midl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /FR /YX /FD /Zm200 /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../3rdParty/include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /FR /YX /FD /Zm200 /c # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe @@ -76,7 +76,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 OpenThreadsWin32d.lib producerd.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"$(OutDir)/osgbluemarbled.exe" /pdbtype:sept /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib" +# ADD LINK32 OpenThreadsWin32d.lib producerd.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"$(OutDir)/osgbluemarbled.exe" /pdbtype:sept /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib" # SUBTRACT LINK32 /incremental:no !ENDIF diff --git a/examples/osgbluemarble/GNUmakefile b/examples/osgbluemarble/GNUmakefile index 7802ee650..97a2c8ab5 100644 --- a/examples/osgbluemarble/GNUmakefile +++ b/examples/osgbluemarble/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgbluemarble.cpp\ -LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osgbluemarble/GNUmakefile.inst b/examples/osgbluemarble/GNUmakefile.inst index 596a6f27f..54c9c76b5 100644 --- a/examples/osgbluemarble/GNUmakefile.inst +++ b/examples/osgbluemarble/GNUmakefile.inst @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgbluemarble.cpp\ -LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osgbluemarble diff --git a/examples/osgbluemarble/osgbluemarble.cpp b/examples/osgbluemarble/osgbluemarble.cpp index 7331f1d7e..9cc584d9c 100644 --- a/examples/osgbluemarble/osgbluemarble.cpp +++ b/examples/osgbluemarble/osgbluemarble.cpp @@ -23,26 +23,48 @@ #include #include -#include +#include -class GraphicsContext { +#include + +class MyGraphicsContext { public: - GraphicsContext() + MyGraphicsContext() { - rs = new Producer::RenderSurface; - rs->setWindowRectangle(0,0,1,1); - rs->useBorder(false); - rs->useConfigEventThread(false); - rs->realize(); - std::cout<<"Realized window"< traits = new osg::GraphicsContext::Traits; + traits->x = 0; + traits->y = 0; + traits->width = 1; + traits->height = 1; + traits->windowDecoration = false; + traits->doubleBuffer = false; + traits->sharedContext = 0; + traits->pbuffer = true; - virtual ~GraphicsContext() - { + _gc = osg::GraphicsContext::createGraphicsContext(traits.get()); + + if (!_gc) + { + osg::notify(osg::NOTICE)<<"Failed to create pbuffer, failing back to normal graphics window."<pbuffer = false; + _gc = osg::GraphicsContext::createGraphicsContext(traits.get()); + } + + if (_gc.valid()) + + + { + _gc->realize(); + _gc->makeCurrent(); + std::cout<<"Realized window"<isRealized(); } + private: - Producer::ref_ptr rs; + osg::ref_ptr _gc; }; @@ -419,7 +441,13 @@ int main( int argc, char **argv ) // create a graphics context to allow us to use OpenGL to compress textures. - GraphicsContext gfx; + MyGraphicsContext gfx; + + if (!gfx.valid() && useCompressedTextures) + { + osg::notify(osg::NOTICE)<<"Disabling texture compression due to inability to create OpenGL graphics context."<