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
016b5c75
Commit
016b5c75
authored
Mar 27, 2012
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add static method to FrameBufferObject to read out current contents of the default frame buffer
parent
97fb9f79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
+4
-0
src/ACGL/OpenGL/Objects/FrameBufferObject.cc
src/ACGL/OpenGL/Objects/FrameBufferObject.cc
+22
-0
No files found.
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
View file @
016b5c75
...
...
@@ -217,6 +217,10 @@ public:
//! get a list of attachment locations and names that can be used to set up a ShaderProgram
SharedLocationMappings
getAttachmentLocations
()
const
;
//! returns the current contents of the default FrameBuffer
//! the format of the returned TextureData will be GL_RGB, the type will be GL_UNSIGNED_INT
static
SharedTextureData
getImageData
(
GLsizei
_width
,
GLsizei
_height
,
GLint
_x
=
0
,
GLint
_y
=
0
,
GLenum
_readBuffer
=
GL_INVALID_ENUM
);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
...
...
src/ACGL/OpenGL/Objects/FrameBufferObject.cc
View file @
016b5c75
...
...
@@ -204,3 +204,25 @@ SharedLocationMappings FrameBufferObject::getAttachmentLocations() const
return
locationMap
;
}
SharedTextureData
FrameBufferObject
::
getImageData
(
GLsizei
_width
,
GLsizei
_height
,
GLint
_x
,
GLint
_y
,
GLenum
_readBuffer
)
{
GLubyte
*
frameBufferData
=
new
GLubyte
[
_width
*
_height
*
3
];
glBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
if
(
_readBuffer
!=
GL_INVALID_ENUM
)
glReadBuffer
(
_readBuffer
);
glReadPixels
(
_x
,
_y
,
_width
,
_height
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
frameBufferData
);
SharedTextureData
texData
=
SharedTextureData
(
new
TextureData
());
texData
->
setWidth
(
_width
);
texData
->
setHeight
(
_height
);
texData
->
setFormat
(
GL_RGB
);
texData
->
setType
(
GL_UNSIGNED_BYTE
);
texData
->
setData
(
frameBufferData
);
// frameBufferData memory will be managed by texData
openGLRareError
();
return
texData
;
}
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