diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 217f0b73c..9cb5146dc 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -32,6 +32,8 @@ #include #include #include + +#include #include #include @@ -376,6 +378,9 @@ namespace MWRender mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("far", mViewDistance)); mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("simpleWater", false)); + // Hopefully, anything genuinely requiring the default alpha func of GL_ALWAYS explicitly sets it + mRootNode->getOrCreateStateSet()->setAttribute(Shader::RemovedAlphaFunc::getInstance(GL_GREATER)); + mUniformNear = mRootNode->getOrCreateStateSet()->getUniform("near"); mUniformFar = mRootNode->getOrCreateStateSet()->getUniform("far"); updateProjectionMatrix(); diff --git a/components/shader/removedalphafunc.cpp b/components/shader/removedalphafunc.cpp index 15d0fb0f1..0da36ab48 100644 --- a/components/shader/removedalphafunc.cpp +++ b/components/shader/removedalphafunc.cpp @@ -17,11 +17,4 @@ namespace Shader sInstances[func - GL_NEVER] = new RemovedAlphaFunc(static_cast(func), 1.0); return sInstances[func - GL_NEVER]; } - - void RemovedAlphaFunc::apply(osg::State & state) const - { - // Hopefully, anything genuinely requiring the default alpha func of GL_ALWAYS explicitly sets it - if (!state.getGlobalDefaultAttribute(ALPHAFUNC)->getType() != getType()) - state.setGlobalDefaultAttribute(static_cast(cloneType())); - } } diff --git a/components/shader/removedalphafunc.hpp b/components/shader/removedalphafunc.hpp index a8165b0dc..1aa9978cf 100644 --- a/components/shader/removedalphafunc.hpp +++ b/components/shader/removedalphafunc.hpp @@ -29,7 +29,7 @@ namespace Shader META_StateAttribute(Shader, RemovedAlphaFunc, ALPHAFUNC); - void apply(osg::State& state) const override; + void apply(osg::State& state) const override {} protected: virtual ~RemovedAlphaFunc() = default;