Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
c27d804a
Commit
c27d804a
authored
Nov 05, 2014
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set GL_PACK_ALIGNMENT to 1 when downloading textures via getTextureImageRAW
parent
18ceab66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
27 deletions
+49
-27
src/ACGL/OpenGL/Objects/Texture.cc
src/ACGL/OpenGL/Objects/Texture.cc
+49
-27
No files found.
src/ACGL/OpenGL/Objects/Texture.cc
View file @
c27d804a
...
...
@@ -10,6 +10,53 @@
using
namespace
ACGL
::
OpenGL
;
namespace
{
// Helper class to set the unpack alignment and reset it to the previous value
// at the end of the scope.
class
ScopedUnpackAlignment
{
public:
ScopedUnpackAlignment
(
size_t
_unpackAlignment
)
{
// Save previous, set new
glGetIntegerv
(
GL_UNPACK_ALIGNMENT
,
&
mPreviousUnpackAlignment
);
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
std
::
min
<
GLuint
>
(
_unpackAlignment
,
8
));
}
~
ScopedUnpackAlignment
()
{
// Restore previous
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
mPreviousUnpackAlignment
);
}
private:
GLint
mPreviousUnpackAlignment
;
};
class
ScopedPackAlignment
{
public:
ScopedPackAlignment
(
size_t
_packAlignment
)
{
// Save previous, set new
glGetIntegerv
(
GL_PACK_ALIGNMENT
,
&
mPreviousUnpackAlignment
);
glPixelStorei
(
GL_PACK_ALIGNMENT
,
std
::
min
<
GLuint
>
(
_packAlignment
,
1
));
}
~
ScopedPackAlignment
()
{
// Restore previous
glPixelStorei
(
GL_PACK_ALIGNMENT
,
mPreviousUnpackAlignment
);
}
private:
GLint
mPreviousUnpackAlignment
;
};
}
void
TextureBase
::
setMinFilter
(
GLint
_value
)
{
GLuint
prevTexture
=
bindAndGetOldTexture
();
...
...
@@ -301,6 +348,8 @@ GLenum TextureBase::getCompatibleType( GLenum _internalFormat )
#ifndef ACGL_OPENGLES_VERSION_20
TextureData
*
TextureBase
::
getTextureImageRAW
(
const
Image
&
_image
,
GLenum
_format
,
GLenum
_type
)
const
{
ScopedPackAlignment
alignment
(
1
);
GLenum
target
=
mTarget
;
if
(
target
==
GL_TEXTURE_CUBE_MAP
||
target
==
GL_TEXTURE_CUBE_MAP_ARRAY
)
{
target
=
_image
.
cubeMapFace
;
...
...
@@ -595,33 +644,6 @@ bool TextureCubeMap::cubeSideIsValid( const GLenum _cubeSide ) const
return
false
;
}
namespace
{
// Helper class to set the unpack alignment and reset it to the previous value
// at the end of the scope.
class
ScopedUnpackAlignment
{
public:
ScopedUnpackAlignment
(
size_t
_unpackAlignment
)
{
// Save previous, set new
glGetIntegerv
(
GL_UNPACK_ALIGNMENT
,
&
mPreviousUnpackAlignment
);
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
std
::
min
<
GLuint
>
(
_unpackAlignment
,
8
));
}
~
ScopedUnpackAlignment
()
{
// Restore previous
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
mPreviousUnpackAlignment
);
}
private:
GLint
mPreviousUnpackAlignment
;
};
}
void
TextureCubeMap
::
texImage2DCube
(
const
SharedTextureData
&
_data
,
GLenum
_cubeSide
,
GLint
_mipmapLevel
)
{
bind
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment