From Pjotr Svetachov, "I was experimenting with VBO's to try to get them on par with display

lists when drawing lots of batches and noticed that my program
generated a lot of unneeded glClientActiveTexture calls. Digging
deeper I found out it came from State::disableTexCoordPointer where
the function would call glClientActiveTexture but not
glDisableClientState because the geometry didn't have texture
coordinates for that channel. This is because in our scene there are
some geometries that have move than one uv channels making
State::_texCoordArrayList grow. Then the method
State::applyDisablingOfVertexAttributes() will call
disableTexCoordPointer multiple times.

I rearrange the method a little to combat this. Now the logic has the
same ordering as disableTexCoordPointersAboveAndIncluding which
already combats this."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14508 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-11-20 17:00:14 +00:00
parent 834c940db1
commit f8c4ad4b90

View File

@ -1102,13 +1102,13 @@ class OSG_EXPORT State : public Referenced
disableVertexAttribPointer(_texCoordAliasList[unit]._location); disableVertexAttribPointer(_texCoordAliasList[unit]._location);
} }
else else
{
if (setClientActiveTextureUnit(unit))
{ {
if ( unit >= _texCoordArrayList.size()) _texCoordArrayList.resize(unit+1); if ( unit >= _texCoordArrayList.size()) _texCoordArrayList.resize(unit+1);
EnabledArrayPair& eap = _texCoordArrayList[unit]; EnabledArrayPair& eap = _texCoordArrayList[unit];
if (eap._enabled || eap._dirty) if (eap._enabled || eap._dirty)
{
if(setClientActiveTextureUnit(unit))
{ {
eap._lazy_disable = false; eap._lazy_disable = false;
eap._enabled = false; eap._enabled = false;