complete TexStorage support

This commit is contained in:
mp3butcher
2018-08-20 05:10:11 +02:00
parent 587e65e674
commit e043c3db33
7 changed files with 169 additions and 77 deletions

View File

@@ -293,8 +293,12 @@ void TextureCubeMap::apply(State& state) const
_textureWidth = _textureHeight = minimum( _textureWidth , _textureHeight );
}
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat(_images[0]) : 0;
textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0);
contextID, GL_TEXTURE_CUBE_MAP, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, 0);
textureObject->bind();
@@ -335,22 +339,33 @@ void TextureCubeMap::apply(State& state) const
}
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) )
{
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat() : 0;
textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0);
contextID, GL_TEXTURE_CUBE_MAP, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
for (int n=0; n<6; n++)
if(texStorageSizedInternalFormat!=0)
{
// no image present, but dimensions at set so less create the texture
glTexImage2D( faceTarget[n], 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, _numMipmapLevels==0 ? 1 : _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, _textureHeight);
}
else
for (int n=0; n<6; n++)
{
// no image present, but dimensions at set so less create the texture
glTexImage2D( faceTarget[n], 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
}
}
else