From f8c4ad4b90d7f06f4657277cd416587d729559cd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 20 Nov 2014 17:00:14 +0000 Subject: [PATCH] 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 --- include/osg/State | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/osg/State b/include/osg/State index 280c6fbbe..ed7025a0a 100644 --- a/include/osg/State +++ b/include/osg/State @@ -1103,12 +1103,12 @@ class OSG_EXPORT State : public Referenced } else { - if (setClientActiveTextureUnit(unit)) - { - if ( unit >= _texCoordArrayList.size()) _texCoordArrayList.resize(unit+1); - EnabledArrayPair& eap = _texCoordArrayList[unit]; + if ( unit >= _texCoordArrayList.size()) _texCoordArrayList.resize(unit+1); + EnabledArrayPair& eap = _texCoordArrayList[unit]; - if (eap._enabled || eap._dirty) + if (eap._enabled || eap._dirty) + { + if(setClientActiveTextureUnit(unit)) { eap._lazy_disable = false; eap._enabled = false;