From Mathias Froehlich, added catch for GL_COLOR_MATERIAL mode being set.

This commit is contained in:
Robert Osfield
2008-09-20 10:09:56 +00:00
parent 8552faf774
commit 4aaf24b5d8

View File

@@ -790,11 +790,7 @@ void StateSet::merge(const StateSet& rhs)
void StateSet::setMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
{
if (!getTextureGLModeSet().isTextureMode(mode))
{
setMode(_modeList,mode,value);
}
else
if (getTextureGLModeSet().isTextureMode(mode))
{
notify(NOTICE)<<"Warning: texture mode '"<<mode<<"'passed to setMode(mode,value), "<<std::endl;
notify(NOTICE)<<" assuming setTextureMode(unit=0,mode,value) instead."<<std::endl;
@@ -802,15 +798,21 @@ void StateSet::setMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue
setTextureMode(0,mode,value);
}
else if (mode == GL_COLOR_MATERIAL)
{
notify(NOTICE)<<"Error: Setting mode 'GL_COLOR_MATERIAL' via osg::StateSet::setMode(mode,value) ignored.\n";
notify(NOTICE)<<" The mode 'GL_COLOR_MATERIAL' is set by the osg::Material StateAttribute.\n";
notify(NOTICE)<<" Setting this as a mode fools osg's State tracking."<<std::endl;
}
else
{
setMode(_modeList,mode,value);
}
}
void StateSet::removeMode(StateAttribute::GLMode mode)
{
if (!getTextureGLModeSet().isTextureMode(mode))
{
setModeToInherit(_modeList,mode);
}
else
if (getTextureGLModeSet().isTextureMode(mode))
{
notify(NOTICE)<<"Warning: texture mode '"<<mode<<"'passed to setModeToInherit(mode), "<<std::endl;
notify(NOTICE)<<" assuming setTextureModeToInherit(unit=0,mode) instead."<<std::endl;
@@ -818,6 +820,16 @@ void StateSet::removeMode(StateAttribute::GLMode mode)
removeTextureMode(0,mode);
}
else if (mode == GL_COLOR_MATERIAL)
{
notify(NOTICE)<<"Error: Setting mode 'GL_COLOR_MATERIAL' via osg::StateSet::removeMode(mode) ignored.\n";
notify(NOTICE)<<" The mode 'GL_COLOR_MATERIAL' is set by the osg::Material StateAttribute.\n";
notify(NOTICE)<<" Setting this as a mode fools osg's State tracking."<<std::endl;
}
else
{
setModeToInherit(_modeList,mode);
}
}