From 81233ba974c962885beda5197e85277d08ba56b3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Nov 2016 15:10:49 +0000 Subject: [PATCH] Cleaned up osgshaderpipeline removing functionality now automatically provided in the core OSG --- .../osgshaderpipeline/osgshaderpipeline.cpp | 109 +----------------- 1 file changed, 4 insertions(+), 105 deletions(-) diff --git a/examples/osgshaderpipeline/osgshaderpipeline.cpp b/examples/osgshaderpipeline/osgshaderpipeline.cpp index 0cb22c03f..bfe514e43 100644 --- a/examples/osgshaderpipeline/osgshaderpipeline.cpp +++ b/examples/osgshaderpipeline/osgshaderpipeline.cpp @@ -107,19 +107,6 @@ bool setUpStateSet(osg::ArgumentParser& arguments, osg::StateSet* stateset) stateset->setTextureAttribute(i, fallbackTexture.get()); } - - ADD_DEFINE(GL_EYE_LINEAR); - ADD_DEFINE(GL_OBJECT_LINEAR); - ADD_DEFINE(GL_SPHERE_MAP); - ADD_DEFINE(GL_NORMAL_MAP); - ADD_DEFINE(GL_REFLECTION_MAP); - - ADD_DEFINE(GL_MODULATE); - ADD_DEFINE(GL_REPLACE); - ADD_DEFINE(GL_DECAL); - ADD_DEFINE(GL_BLEND); - ADD_DEFINE(GL_ADD); - ADD_DEFINE(GL_ALPHA); ADD_DEFINE(GL_INTENSITY); ADD_DEFINE(GL_LUMINANCE); @@ -128,98 +115,6 @@ bool setUpStateSet(osg::ArgumentParser& arguments, osg::StateSet* stateset) ADD_DEFINE(GL_RGB); ADD_DEFINE(GL_RGBA); - - osg::ref_ptr ACTIVE_TEXTURE = new osg::Uniform(osg::Uniform::BOOL, "GL_ACTIVE_TEXTURE", maxTextureUnits); - osg::ref_ptr TEXTURE_GEN_S = new osg::Uniform(osg::Uniform::BOOL, "GL_TEXTURE_GEN_S", maxTextureUnits); - osg::ref_ptr TEXTURE_GEN_T = new osg::Uniform(osg::Uniform::BOOL, "GL_TEXTURE_GEN_T", maxTextureUnits); - - osg::ref_ptr TEXTURE_GEN_MODE = new osg::Uniform(osg::Uniform::INT, "GL_TEXTURE_GEN_MODE", maxTextureUnits); - osg::ref_ptr TEXTURE_ENV_MODE = new osg::Uniform(osg::Uniform::INT, "GL_TEXTURE_ENV_MODE", maxTextureUnits); - osg::ref_ptr TEXTURE_FORMAT = new osg::Uniform(osg::Uniform::INT, "GL_TEXTURE_FORMAT", maxTextureUnits); - - - for(unsigned int i=0; isetElement(i, false); - TEXTURE_GEN_MODE->setElement(i, 0); - TEXTURE_GEN_S->setElement(i, false); - TEXTURE_GEN_T->setElement(i, false); - TEXTURE_ENV_MODE->setElement(i, GL_MODULATE); - TEXTURE_FORMAT->setElement(i, GL_RGBA); - } - - ACTIVE_TEXTURE->setElement(0, true); - TEXTURE_GEN_MODE->setElement(0, 0); - //TEXTURE_GEN_MODE->setElement(0, GL_SPHERE_MAP); - TEXTURE_GEN_S->setElement(0, true); - TEXTURE_GEN_T->setElement(0, true); - //TEXTURE_FORMAT->setElement(0, GL_ALPHA); - - stateset->addUniform(ACTIVE_TEXTURE.get()); - stateset->addUniform(TEXTURE_GEN_S.get()); - stateset->addUniform(TEXTURE_GEN_T.get()); - stateset->addUniform(TEXTURE_GEN_MODE.get()); - stateset->addUniform(TEXTURE_ENV_MODE.get()); - stateset->addUniform(TEXTURE_FORMAT.get()); - - - for(unsigned int i=0; iaddUniform(new osg::Uniform(sstream.str().c_str(), static_cast(i))); - -#if 0 - // fragment shader texture defines - sstream.str(""); - sstream<<"TEXTURE_VERT_DECLARE"<setDefine(textureVertDeclareDefine, sstream.str()); - - - sstream.str(""); - sstream<<"TEXTURE_VERT_BODY"<setDefine(textureVertBodyDefine, sstream.str()); - - - // fragment shader texture defines - sstream.str(""); - sstream<<"TEXTURE_FRAG_DECLARE"<setDefine(textureFragDeclareDefine, sstream.str()); - - - sstream.str(""); - sstream<<"TEXTURE_FRAG_BODY"<setDefine(textureFragBodyDefine, sstream.str()); -#endif - - } - } osgDB::writeObjectFile(*stateset, "stateset.osgt"); @@ -244,6 +139,10 @@ struct RealizeOperation : public osg::GraphicsOperation gc->getState()->setUseModelViewAndProjectionUniforms(_useModelViewAndProjectionUniforms); gc->getState()->setUseVertexAttributeAliasing(_useVertexAttributeAliasing); + + gc->getState()->setUseStateAttributeShaders(true); + gc->getState()->setUseStateAttributeFixedFunction(true); + if (_stateset.valid()) gc->getState()->setRootStateSet(_stateset.get()); }