diff --git a/src/osg/Texture2D.cpp b/src/osg/Texture2D.cpp index 1f545e316..b8ebe846c 100644 --- a/src/osg/Texture2D.cpp +++ b/src/osg/Texture2D.cpp @@ -194,14 +194,13 @@ void Texture2D::apply(State& state) const // compute the internal texture format, this set the _internalFormat to an appropriate value. computeInternalFormat(); - + // compute the dimensions of the texture. computeRequiredTextureDimensions(state,*image,_textureWidth, _textureHeight, _numMipmapLevels); - - - textureObject = generateTextureObject( + + _textureObjectBuffer[contextID] = textureObject = generateTextureObject( contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_2D,state); @@ -217,16 +216,13 @@ void Texture2D::apply(State& state) const //notify(NOTICE)<<"Creating new texture object"<setAllocated(true); } - - + // update the modified tag to show that it is upto date. getModifiedCount(contextID) = image->getModifiedCount(); - _textureObjectBuffer[contextID] = textureObject; - if (_unrefImageDataAfterApply && areAllTextureObjectsLoaded() && image->getDataVariance()==STATIC) { Texture2D* non_const_this = const_cast(this);