Skip to content
Snippets Groups Projects
Commit 847e1ab1 authored by Janis Born's avatar Janis Born
Browse files

fix missing unpack alignment for texSubImage3D

parent d9cdd85a
No related branches found
No related tags found
No related merge requests found
......@@ -597,6 +597,7 @@ bool TextureCubeMap::cubeSideIsValid( const GLenum _cubeSide ) const
void TextureCubeMap::texImage2DCube( const SharedTextureData &_data, GLenum _cubeSide, GLint _mipmapLevel )
{
bind();
mWidth = _data->getWidth();
mHeight = _data->getHeight();
......@@ -604,7 +605,6 @@ void TextureCubeMap::texImage2DCube( const SharedTextureData &_data, GLenum _cub
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
bind();
glTexImage2D(
_cubeSide,
_mipmapLevel,
......@@ -620,11 +620,11 @@ void TextureCubeMap::texImage2DCube( const SharedTextureData &_data, GLenum _cub
void TextureCubeMap::texSubImage2DCube( const SharedTextureData &_data, GLenum _cubeSide, GLint _mipmapLevel, glm::ivec2 _offset )
{
bind();
GLint previousUnpackAlignment;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
bind();
glTexSubImage2D(
_cubeSide,
_mipmapLevel,
......@@ -641,13 +641,13 @@ void TextureCubeMap::texSubImage2DCube( const SharedTextureData &_data, GLenum _
void TextureBase::texImage1D( const SharedTextureData &_data, GLint _mipmapLevel )
{
bind();
mWidth = _data->getWidth();
GLint previousUnpackAlignment;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
bind();
glTexImage1D(
mTarget,
_mipmapLevel,
......@@ -684,11 +684,10 @@ void TextureBase::texSubImage1D( const SharedTextureData &_data, GLint _mipmapLe
void TextureBase::texImage2D( const SharedTextureData &_data, GLint _mipmapLevel )
{
bind();
mWidth = _data->getWidth();
mHeight = _data->getHeight();
bind();
GLint previousUnpackAlignment;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
......@@ -708,6 +707,7 @@ void TextureBase::texImage2D( const SharedTextureData &_data, GLint _mipmapLevel
void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLevel, glm::uvec2 _offset )
{
bind();
GLsizei w = std::min( mWidth, _data->getWidth() );
GLsizei h = std::max( std::min( mHeight, _data->getHeight() ), 1);
......@@ -715,7 +715,6 @@ void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLe
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
bind();
glTexSubImage2D(
mTarget,
_mipmapLevel,
......@@ -731,6 +730,7 @@ void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLe
void TextureBase::texImage3D( const SharedTextureData &_data, GLint _mipmapLevel )
{
bind();
mWidth = _data->getWidth();
mHeight = _data->getHeight();
mDepth = _data->getDepth();
......@@ -739,7 +739,6 @@ void TextureBase::texImage3D( const SharedTextureData &_data, GLint _mipmapLevel
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
bind();
glTexImage3D(
mTarget,
_mipmapLevel,
......@@ -760,6 +759,10 @@ void TextureBase::texSubImage3D( const SharedTextureData &_data, GLint _mipmapLe
GLsizei h = std::max( std::min( mHeight, _data->getHeight() ), 1);
GLsizei d = std::max( std::min( mDepth, _data->getDepth() ), 1);
GLint previousUnpackAlignment;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &previousUnpackAlignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(_data->getPackAlignment(), 8));
glTexSubImage3D(
mTarget,
_mipmapLevel,
......@@ -768,5 +771,7 @@ void TextureBase::texSubImage3D( const SharedTextureData &_data, GLint _mipmapLe
_data->getFormat(),
_data->getType(),
_data->getData() );
glPixelStorei(GL_UNPACK_ALIGNMENT, previousUnpackAlignment);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment