prevent immutability resetting when textureobject is taken from orphans

This commit is contained in:
Julien Valentin
2020-03-25 23:00:24 +01:00
parent 864b087b1f
commit 197fc401b4
7 changed files with 37 additions and 14 deletions

View File

@@ -353,7 +353,7 @@ void Texture2DArray::apply(State& state) const
applyTexParameters(GL_TEXTURE_2D_ARRAY, state);
// First we need to allocate the texture memory
if(texStorageSizedInternalFormat!=0)
if(texStorageSizedInternalFormat!=0 && !textureObject->_allocated)
{
extensions->glTexStorage3D(GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, textureDepth);
}
@@ -452,7 +452,7 @@ void Texture2DArray::apply(State& state) const
applyTexParameters(GL_TEXTURE_2D_ARRAY,state);
if (texStorageSizedInternalFormat!=0)
if (texStorageSizedInternalFormat!=0 && !textureObject->_allocated)
{
extensions->glTexStorage3D( GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
}
@@ -463,6 +463,8 @@ void Texture2DArray::apply(State& state) const
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat :_internalFormat, _textureWidth, _textureHeight, _textureDepth, 0);
}
// nothing before, so just unbind the texture target