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

@@ -230,18 +230,30 @@ void Texture1D::apply(State& state) const
}
else if ( (_textureWidth!=0) && (_internalFormat!=0) )
{
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D,_numMipmapLevels,_internalFormat,_textureWidth,1,1,0);
// no image present, but dimensions at set so lets create the texture
GLExtensions * extensions = state.get<GLExtensions>();
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled ? selectSizedInternalFormat() : 0;
if (texStorageSizedInternalFormat!=0)
{
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, 1, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_1D, state);
textureObject->bind();
extensions->glTexStorage1D( GL_TEXTURE_1D, (_numMipmapLevels >0)?_numMipmapLevels:1, texStorageSizedInternalFormat, _textureWidth);
}
else
{
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, internalFormat, _textureWidth, 1, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_1D, state);
applyTexParameters(GL_TEXTURE_1D,state);
// no image present, but dimensions are set so lets create the texture
glTexImage1D( GL_TEXTURE_1D, 0, _internalFormat,
glTexImage1D( GL_TEXTURE_1D, 0, _internalFormat,
_textureWidth, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
}
if (_readPBuffer.valid())
{