From 16c55531da9b777eb3a794ee881c9919330e5ee3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 14 Apr 2005 11:28:23 +0000 Subject: [PATCH] Preparation for moving osgGL2 out of the core OSG into its own seperate distribution. --- Make/dependencies | 2 ++ Make/makedirdefs | 15 ++++++++++++--- VisualStudio/VisualStudio.dsw | 21 --------------------- applications/osgdem/GNUmakefile | 2 +- applications/osgdem/GNUmakefile.inst | 2 +- examples/osgfxbrowser/GNUmakefile | 2 +- examples/osgkeyboardmouse/GNUmakefile | 2 +- examples/osgkeyboardmouse/GNUmakefile.inst | 2 +- examples/osgsimplepager/GNUmakefile | 2 +- examples/osgsimplepager/GNUmakefile.inst | 2 +- examples/osgsimulation/GNUmakefile | 2 +- runexamples.bat | 12 ++++++------ src/osgFX/Cartoon.cpp | 20 ++++++++++---------- src/osgFX/GNUmakefile | 2 +- src/osgPlugins/ive/GNUmakefile | 2 +- src/osgPlugins/lwo/GNUmakefile | 2 +- src/osgPlugins/osgFX/GNUmakefile | 2 +- 17 files changed, 42 insertions(+), 52 deletions(-) diff --git a/Make/dependencies b/Make/dependencies index 9de04d00a..2ad12c0f1 100644 --- a/Make/dependencies +++ b/Make/dependencies @@ -8,6 +8,8 @@ COMPILE_INTROSPECTION = no # should we compile any of the examples? COMPILE_EXAMPLES ?= no +# should we compile the deprecated osgGL2 library. +COMPILE_osgGL2 ?= no # follows are dependenices on the various plugins. diff --git a/Make/makedirdefs b/Make/makedirdefs index 6cb0c2582..9da147445 100644 --- a/Make/makedirdefs +++ b/Make/makedirdefs @@ -20,9 +20,13 @@ SRC_DIRS = \ osgParticle\ osgText\ osgSim\ - osgGL2\ - osgFX\ - osgProducer\ + osgProducer + +ifeq ($(COMPILE_osgGL2),yes) +SRC_DIRS += osgGL2 +endif + +SRC_DIRS += osgFX ifeq ($(GDAL_INSTALLED),yes) SRC_DIRS += osgTerrain @@ -42,6 +46,8 @@ WRAPPER_DIRS = \ osg\ + + ################################################################ # Directories traversed in the TOPDIR/src/osgPlugins directory @@ -237,6 +243,9 @@ EXAMPLE_DIRS = \ osgvolume\ osgwindows\ +ifeq ($(COMPILE_osgGL2),yes) + EXAMPLE_DIRS += osgGL2Shaders +endif ifeq ($(COMPILE_INTROSPECTION),yes) EXAMPLE_DIRS += osgintrospection diff --git a/VisualStudio/VisualStudio.dsw b/VisualStudio/VisualStudio.dsw index 4d6152714..7c2b862f8 100644 --- a/VisualStudio/VisualStudio.dsw +++ b/VisualStudio/VisualStudio.dsw @@ -116,9 +116,6 @@ Package=<4> Begin Project Dependency Project_Dep_Name Core osgDB End Project Dependency - Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency }}} ############################################################################### @@ -723,9 +720,6 @@ Package=<4> Project_Dep_Name Core osgFX End Project Dependency Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency - Begin Project Dependency Project_Dep_Name Core osgGA End Project Dependency Begin Project Dependency @@ -953,9 +947,6 @@ Package=<4> Begin Project Dependency Project_Dep_Name Core osgFX End Project Dependency - Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency }}} ############################################################################### @@ -1461,9 +1452,6 @@ Package=<4> Project_Dep_Name Core osgGA End Project Dependency Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency - Begin Project Dependency Project_Dep_Name Core osgText End Project Dependency Begin Project Dependency @@ -1580,9 +1568,6 @@ Package=<4> Begin Project Dependency Project_Dep_Name Core osgFX End Project Dependency - Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency }}} ############################################################################### @@ -1607,9 +1592,6 @@ Package=<4> Begin Project Dependency Project_Dep_Name Core osgFX End Project Dependency - Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency }}} ############################################################################### @@ -2459,9 +2441,6 @@ Package=<4> Begin Project Dependency Project_Dep_Name Core osgFX End Project Dependency - Begin Project Dependency - Project_Dep_Name Core osgGL2 - End Project Dependency }}} ############################################################################### diff --git a/applications/osgdem/GNUmakefile b/applications/osgdem/GNUmakefile index 528bc176a..0e636ca8f 100644 --- a/applications/osgdem/GNUmakefile +++ b/applications/osgdem/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgdem.cpp\ -LIBS += -losgProducer -lProducer -losgTerrain -losgFX -losgGL2 -losgText -losgGA -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgProducer -lProducer -losgTerrain -losgFX -losgText -losgGA -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/applications/osgdem/GNUmakefile.inst b/applications/osgdem/GNUmakefile.inst index 45e88b0a1..771b63e8d 100644 --- a/applications/osgdem/GNUmakefile.inst +++ b/applications/osgdem/GNUmakefile.inst @@ -5,7 +5,7 @@ CXXFILES =\ osgdem.cpp\ -LIBS += -losgProducer -lProducer -losgTerrain -losgFX -losgGL2 -losgDB -losgText -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgProducer -lProducer -losgTerrain -losgFX -losgDB -losgText -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osgdem diff --git a/examples/osgfxbrowser/GNUmakefile b/examples/osgfxbrowser/GNUmakefile index 145217518..2c641fc50 100644 --- a/examples/osgfxbrowser/GNUmakefile +++ b/examples/osgfxbrowser/GNUmakefile @@ -5,7 +5,7 @@ CXXFILES =\ osgfxbrowser.cpp\ Frame.cpp\ -LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg -losgGL2 -losgFX $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg -losgFX $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osgkeyboardmouse/GNUmakefile b/examples/osgkeyboardmouse/GNUmakefile index b0e32361a..41876cd8b 100644 --- a/examples/osgkeyboardmouse/GNUmakefile +++ b/examples/osgkeyboardmouse/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgkeyboardmouse.cpp\ -LIBS += -lProducer -losgFX -losgGL2 -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads +LIBS += -lProducer -losgFX -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osgkeyboardmouse/GNUmakefile.inst b/examples/osgkeyboardmouse/GNUmakefile.inst index fb3209383..9a2e627f9 100644 --- a/examples/osgkeyboardmouse/GNUmakefile.inst +++ b/examples/osgkeyboardmouse/GNUmakefile.inst @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgkeyboardmouse.cpp\ -LIBS += -lProducer -losgFX -losgGL2 -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -lProducer -losgFX -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osgkeyboardmouse diff --git a/examples/osgsimplepager/GNUmakefile b/examples/osgsimplepager/GNUmakefile index 33040ba9c..119bc1344 100644 --- a/examples/osgsimplepager/GNUmakefile +++ b/examples/osgsimplepager/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgsimplepager.cpp\ -LIBS += -lProducer -losgFX -losgGL2 -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads +LIBS += -lProducer -losgFX -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osgsimplepager/GNUmakefile.inst b/examples/osgsimplepager/GNUmakefile.inst index eb90c9ad3..665535160 100644 --- a/examples/osgsimplepager/GNUmakefile.inst +++ b/examples/osgsimplepager/GNUmakefile.inst @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgsimplepager.cpp\ -LIBS += -lProducer -losgFX -losgGL2 -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -lProducer -losgFX -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osgsimplepager diff --git a/examples/osgsimulation/GNUmakefile b/examples/osgsimulation/GNUmakefile index 8c4002b8c..85b94651c 100644 --- a/examples/osgsimulation/GNUmakefile +++ b/examples/osgsimulation/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgsimulation.cpp\ -LIBS += -losgTerrain -losgFX -losgGL2 -losgProducer -lProducer -losgParticle -losgSim -losgText -losgGA -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgTerrain -losgFX -losgProducer -lProducer -losgParticle -losgSim -losgText -losgGA -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/runexamples.bat b/runexamples.bat index 867079deb..90daad65f 100644 --- a/runexamples.bat +++ b/runexamples.bat @@ -30,14 +30,14 @@ osgclip cow.osg echo osgcubemap osgcubemap cessna.osg -echo osgdepthshadow -osgdepthshadow +# echo osgdepthshadow +# osgdepthshadow echo osgdistortion osgdistortion cow.osg -echo osgforest -osgforest +#echo osgforest +#osgforest echo osgfxbrowser osgfxbrowser dumptruck.osg @@ -96,8 +96,8 @@ osgplanets echo osgprerender osgprerender dumptruck.osg -echo osgprerendercubemap -osgprerendercubemap +#echo osgprerendercubemap +#osgprerendercubemap echo osgreflect osgreflect cessna.osg diff --git a/src/osgFX/Cartoon.cpp b/src/osgFX/Cartoon.cpp index b79262e3a..1ad5db279 100644 --- a/src/osgFX/Cartoon.cpp +++ b/src/osgFX/Cartoon.cpp @@ -10,8 +10,9 @@ #include #include #include +#include +#include -#include #include @@ -44,7 +45,6 @@ namespace // register a prototype for this effect Registry::Proxy proxy(new Cartoon); - // default technique class class DefaultTechnique: public Technique { public: @@ -152,12 +152,11 @@ namespace /////////////////////////////////////////////////////////////////////////// // A port of Marco Jez's "cartoon.cg" to the OpenGL Shading Language -// using osgGL2 by Mike Weiblen 2003-10-03. +// by Mike Weiblen 2003-10-03, // // This shader is simplified due to limitations in the OGLSL implementation // in the current 3Dlabs driver. As the OGLSL implementation improves, // need to revisit and enhance this shader. - namespace { class OGLSL_Technique : public Technique { @@ -178,7 +177,6 @@ namespace { // implement pass #1 (solid surfaces) { - const char * vert_source = "const vec3 LightPosition = vec3( 0.0, 2.0, 4.0 );" "varying float CartoonTexCoord;" @@ -204,11 +202,13 @@ namespace polyoffset->setUnits(1.0f); ss->setAttributeAndModes(polyoffset.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); - osg::ref_ptr progObj = new osgGL2::ProgramObject; - progObj->addShader( new osgGL2::ShaderObject( osgGL2::ShaderObject::VERTEX, vert_source ) ); - progObj->addShader( new osgGL2::ShaderObject( osgGL2::ShaderObject::FRAGMENT, frag_source ) ); - progObj->setSampler( "CartoonTexUnit", 0 ); - ss->setAttributeAndModes( progObj.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); + osg::ref_ptr program = new osg::Program; + program->addShader( new osg::Shader( osg::Shader::VERTEX, vert_source ) ); + program->addShader( new osg::Shader( osg::Shader::FRAGMENT, frag_source ) ); + + ss->addUniform( new osg::Uniform("CartoonTexUnit", 0)); + ss->setAttributeAndModes( program.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); + ss->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF); diff --git a/src/osgFX/GNUmakefile b/src/osgFX/GNUmakefile index 5a6a020c9..9817740ff 100644 --- a/src/osgFX/GNUmakefile +++ b/src/osgFX/GNUmakefile @@ -13,8 +13,8 @@ CXXFILES =\ Technique.cpp\ Validator.cpp\ +LIBS += -losg -losgDB -losgUtil $(GL_LIBS) $(OTHER_LIBS) $(DYNAMICLIBRARYLIB) -LIBS += -losg -losgDB -losgUtil -losgGL2 $(GL_LIBS) $(OTHER_LIBS) $(DYNAMICLIBRARYLIB) DEF += -DOSGFX_LIBRARY TARGET_BASENAME = osgFX diff --git a/src/osgPlugins/ive/GNUmakefile b/src/osgPlugins/ive/GNUmakefile index 9d2b2f57f..5bb07e6e8 100644 --- a/src/osgPlugins/ive/GNUmakefile +++ b/src/osgPlugins/ive/GNUmakefile @@ -80,7 +80,7 @@ CXXFILES =\ VertexProgram.cpp\ VisibilityGroup.cpp\ -LIBS += -losgFX -losgGL2 -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS) +LIBS += -losgFX -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS) TARGET_BASENAME = ive include $(TOPDIR)/Make/cygwin_plugin_def diff --git a/src/osgPlugins/lwo/GNUmakefile b/src/osgPlugins/lwo/GNUmakefile index 23ab3857b..7b0dfbf53 100644 --- a/src/osgPlugins/lwo/GNUmakefile +++ b/src/osgPlugins/lwo/GNUmakefile @@ -19,7 +19,7 @@ CXXFILES =\ INC += -I$(THISDIR) -LIBS += -losgFX -losgGL2 $(OSG_LIBS) $(OTHER_LIBS) $(GL_LIBS) +LIBS += -losgFX $(OSG_LIBS) $(OTHER_LIBS) $(GL_LIBS) TARGET_BASENAME = lwo include $(TOPDIR)/Make/cygwin_plugin_def diff --git a/src/osgPlugins/osgFX/GNUmakefile b/src/osgPlugins/osgFX/GNUmakefile index fdae17e05..50d6c6a1f 100644 --- a/src/osgPlugins/osgFX/GNUmakefile +++ b/src/osgPlugins/osgFX/GNUmakefile @@ -11,7 +11,7 @@ CXXFILES =\ IO_Effect.cpp\ -LIBS += -losgFX -losgGL2 $(OSG_LIBS) $(OTHER_LIBS) +LIBS += -losgFX $(OSG_LIBS) $(OTHER_LIBS) TARGET_BASENAME = osgFX include $(TOPDIR)/Make/cygwin_plugin_def