From Michael Bach Jensen and Robert Osfield, "As discussed (http://forum.openscenegraph.org/viewtopic.php?t=12027) here is my submission :-)
The following change to State.cpp fixes the case where textures in a stateset along with a compute shader program did not make those textures available to the shader, since it got evaluated before the texture bind(s)." Note from Robert, Michael only change State::apply(StateSet*) so I also applied the same reversal in apply of texutre modes/state into the State::apply() method for consistency.
This commit is contained in:
@@ -505,9 +505,7 @@ void State::apply(const StateSet* dstate)
|
||||
|
||||
_currentShaderCompositionUniformList.clear();
|
||||
|
||||
applyModeList(_modeMap,dstate->getModeList());
|
||||
applyAttributeList(_attributeMap,dstate->getAttributeList());
|
||||
|
||||
// apply all texture state and modes
|
||||
const StateSet::TextureModeList& ds_textureModeList = dstate->getTextureModeList();
|
||||
const StateSet::TextureAttributeList& ds_textureAttributeList = dstate->getTextureAttributeList();
|
||||
|
||||
@@ -524,6 +522,9 @@ void State::apply(const StateSet* dstate)
|
||||
else if (unit<_textureAttributeMapList.size()) applyAttributeMapOnTexUnit(unit,_textureAttributeMapList[unit]);
|
||||
}
|
||||
|
||||
applyModeList(_modeMap,dstate->getModeList());
|
||||
applyAttributeList(_attributeMap,dstate->getAttributeList());
|
||||
|
||||
if (_shaderCompositionEnabled)
|
||||
{
|
||||
applyShaderComposition();
|
||||
@@ -569,13 +570,7 @@ void State::apply()
|
||||
|
||||
if (_shaderCompositionEnabled) _currentShaderCompositionUniformList.clear();
|
||||
|
||||
// go through all active OpenGL modes, enabling/disable where
|
||||
// appropriate.
|
||||
applyModeMap(_modeMap);
|
||||
|
||||
// go through all active StateAttribute's, applying where appropriate.
|
||||
applyAttributeMap(_attributeMap);
|
||||
|
||||
// apply all texture state and modes
|
||||
unsigned int unit;
|
||||
unsigned int unitMax = maximum(_textureModeMapList.size(),_textureAttributeMapList.size());
|
||||
for(unit=0;unit<unitMax;++unit)
|
||||
@@ -584,6 +579,14 @@ void State::apply()
|
||||
if (unit<_textureAttributeMapList.size()) applyAttributeMapOnTexUnit(unit,_textureAttributeMapList[unit]);
|
||||
}
|
||||
|
||||
// go through all active OpenGL modes, enabling/disable where
|
||||
// appropriate.
|
||||
applyModeMap(_modeMap);
|
||||
|
||||
// go through all active StateAttribute's, applying where appropriate.
|
||||
applyAttributeMap(_attributeMap);
|
||||
|
||||
|
||||
if (_shaderCompositionEnabled)
|
||||
{
|
||||
applyShaderComposition();
|
||||
|
||||
Reference in New Issue
Block a user