diff --git a/src/osg/Texture1D.cpp b/src/osg/Texture1D.cpp index 0d6796ce9..ca3821a37 100644 --- a/src/osg/Texture1D.cpp +++ b/src/osg/Texture1D.cpp @@ -124,6 +124,10 @@ void Texture1D::apply(State& state) const // current OpenGL context. const unsigned int contextID = state.getContextID(); + Texture::TextureObjectManager* tom = Texture::getTextureObjectManager(contextID); + ElapsedTime elapsedTime(&(tom->getApplyTime())); + tom->getNumberApplied()++; + // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); diff --git a/src/osg/Texture2DArray.cpp b/src/osg/Texture2DArray.cpp index fad8e58fb..c2411f941 100644 --- a/src/osg/Texture2DArray.cpp +++ b/src/osg/Texture2DArray.cpp @@ -208,6 +208,11 @@ void Texture2DArray::apply(State& state) const // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); + + Texture::TextureObjectManager* tom = Texture::getTextureObjectManager(contextID); + ElapsedTime elapsedTime(&(tom->getApplyTime())); + tom->getNumberApplied()++; + const Extensions* extensions = getExtensions(contextID,true); // if not supported, then return diff --git a/src/osg/Texture3D.cpp b/src/osg/Texture3D.cpp index 3cab25ed2..10d202dab 100644 --- a/src/osg/Texture3D.cpp +++ b/src/osg/Texture3D.cpp @@ -195,7 +195,11 @@ void Texture3D::apply(State& state) const // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - + + Texture::TextureObjectManager* tom = Texture::getTextureObjectManager(contextID); + ElapsedTime elapsedTime(&(tom->getApplyTime())); + tom->getNumberApplied()++; + const Extensions* extensions = getExtensions(contextID,true); if (!extensions->isTexture3DSupported()) diff --git a/src/osg/TextureCubeMap.cpp b/src/osg/TextureCubeMap.cpp index 548ca4f0a..079346c59 100644 --- a/src/osg/TextureCubeMap.cpp +++ b/src/osg/TextureCubeMap.cpp @@ -196,6 +196,11 @@ void TextureCubeMap::apply(State& state) const // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); + + Texture::TextureObjectManager* tom = Texture::getTextureObjectManager(contextID); + ElapsedTime elapsedTime(&(tom->getApplyTime())); + tom->getNumberApplied()++; + const Extensions* extensions = getExtensions(contextID,true); if (!extensions->isCubeMapSupported()) diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index dc791c87d..8d6e9d35a 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -161,8 +161,10 @@ void TextureRectangle::apply(State& state) const // current OpenGL context. const unsigned int contextID = state.getContextID(); + Texture::TextureObjectManager* tom = Texture::getTextureObjectManager(contextID); + ElapsedTime elapsedTime(&(tom->getApplyTime())); + tom->getNumberApplied()++; - static OpenThreads::Mutex s_mutex; // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); @@ -209,9 +211,7 @@ void TextureRectangle::apply(State& state) const else if (_image.valid() && _image->data()) { - OpenThreads::ScopedLock lock(s_mutex); - - // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. + // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. textureObject = generateTextureObject(this, contextID,GL_TEXTURE_RECTANGLE); textureObject->bind();