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
f02e3497
Commit
f02e3497
authored
Apr 26, 2012
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remember and restore previoulsy bound texture state in Texture::getImageData
parent
5094dc90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
src/ACGL/OpenGL/Objects/Texture.cc
src/ACGL/OpenGL/Objects/Texture.cc
+14
-0
No files found.
src/ACGL/OpenGL/Objects/Texture.cc
View file @
f02e3497
...
...
@@ -79,6 +79,17 @@ SharedTextureData Texture::getImageData(GLint _lod, GLenum _type) const
{
if
(
_type
==
GL_INVALID_ENUM
)
_type
=
mType
;
// remember the previously bound texture
GLint
prevTexture
;
if
(
mTarget
==
GL_TEXTURE_1D
)
glGetIntegerv
(
GL_TEXTURE_BINDING_1D
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_2D
)
glGetIntegerv
(
GL_TEXTURE_BINDING_2D
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_3D
)
glGetIntegerv
(
GL_TEXTURE_BINDING_3D
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_1D_ARRAY
)
glGetIntegerv
(
GL_TEXTURE_BINDING_1D_ARRAY
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_2D_ARRAY
)
glGetIntegerv
(
GL_TEXTURE_BINDING_2D_ARRAY
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_RECTANGLE
)
glGetIntegerv
(
GL_TEXTURE_BINDING_RECTANGLE
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_2D_MULTISAMPLE
)
glGetIntegerv
(
GL_TEXTURE_BINDING_2D_MULTISAMPLE
,
&
prevTexture
);
else
if
(
mTarget
==
GL_TEXTURE_2D_MULTISAMPLE_ARRAY
)
glGetIntegerv
(
GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
,
&
prevTexture
);
// determine the required buffer size to hold the requested LOD level
bind
();
GLint
width
,
height
,
depth
;
...
...
@@ -93,6 +104,9 @@ SharedTextureData Texture::getImageData(GLint _lod, GLenum _type) const
GLubyte
*
imageData
=
new
GLubyte
[
width
*
height
*
getGLTypeSize
(
_type
)
*
channels
];
glGetTexImage
(
mTarget
,
_lod
,
GL_RGB
,
_type
,
(
GLvoid
*
)
imageData
);
// revert to the previously bound texture
glBindTexture
(
mTarget
,
prevTexture
);
// store the image data and meta information in a TextureData object
SharedTextureData
dataObject
=
SharedTextureData
(
new
TextureData
());
dataObject
->
setWidth
(
width
);
...
...
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