diff --git a/ogre2/include/ignition/rendering/ogre2/Ogre2RenderEngine.hh b/ogre2/include/ignition/rendering/ogre2/Ogre2RenderEngine.hh index ffe3a2194..c7dd6ef58 100644 --- a/ogre2/include/ignition/rendering/ogre2/Ogre2RenderEngine.hh +++ b/ogre2/include/ignition/rendering/ogre2/Ogre2RenderEngine.hh @@ -24,6 +24,7 @@ #include +#include "ignition/rendering/GraphicsAPI.hh" #include "ignition/rendering/RenderEnginePlugin.hh" #include "ignition/rendering/base/BaseRenderEngine.hh" #include "ignition/rendering/base/BaseRenderTypes.hh" @@ -118,6 +119,12 @@ namespace ignition const unsigned int _width, const unsigned int _height, const double _ratio, const unsigned int _antiAliasing); + /// \brief Get the render engine's graphics API + /// Note: Do not merge this forward. This has been changed to + /// virtual function in ign-rendering7 + /// \return The graphics API enum class + public: rendering::GraphicsAPI GraphicsAPI() const; + /// \brief Create a scene /// \param[in] _id Unique scene Id /// \param[in] _name Name of scene diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index 924a29e2a..7e4ae20c4 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -40,6 +40,7 @@ #include #include +#include "ignition/rendering/GraphicsAPI.hh" #include "ignition/rendering/ShaderParams.hh" #include "ignition/rendering/ShaderType.hh" #include "ignition/rendering/ogre2/Ogre2Material.hh" @@ -646,7 +647,11 @@ void Ogre2Material::UpdateShaderParams(ConstShaderParamsPtr _params, continue; } - if (!_ogreParams->_findNamedConstantDefinition(name_param.first)) + if (!_ogreParams->_findNamedConstantDefinition(name_param.first) && + !(Ogre2RenderEngine::Instance()->GraphicsAPI() != + GraphicsAPI::OPENGL && + (ShaderParam::PARAM_TEXTURE == name_param.second.Type() || + ShaderParam::PARAM_TEXTURE_CUBE == name_param.second.Type()))) { ignwarn << "Unable to find GPU program parameter: " << name_param.first << std::endl; diff --git a/ogre2/src/Ogre2RenderEngine.cc b/ogre2/src/Ogre2RenderEngine.cc index f3bce6cc7..c3d18c929 100644 --- a/ogre2/src/Ogre2RenderEngine.cc +++ b/ogre2/src/Ogre2RenderEngine.cc @@ -992,6 +992,12 @@ std::string Ogre2RenderEngine::CreateRenderWindow(const std::string &_handle, return stream.str(); } +////////////////////////////////////////////////// +GraphicsAPI Ogre2RenderEngine::GraphicsAPI() const +{ + return this->dataPtr->graphicsAPI; +} + ////////////////////////////////////////////////// void Ogre2RenderEngine::InitAttempt() {