Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
0191bfdf
Commit
0191bfdf
authored
Oct 14, 2011
by
Andreas Neu
Browse files
* Added the possibility to modifiy the texture targets for a framebufferobject
parent
9f51e032
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
View file @
0191bfdf
...
...
@@ -32,6 +32,7 @@
#include
<ACGL/OpenGL/Objects/Texture.hh>
#include
<vector>
#include
<map>
#include
<tr1/memory>
namespace
ACGL
{
...
...
@@ -150,9 +151,11 @@ public:
Utils
::
error
()
<<
"Attaching of texture to the FBO failed"
<<
std
::
endl
;
return
false
;
}
mDrawBuffers
++
;
Attachment
attachment
=
{
_name
,
SharedTexture
(),
_renderBuffer
};
mColorAttachments
.
push_back
(
attachment
);
mColorAttachmentIndices
[
_name
]
=
mDrawBuffers
;
mDrawBuffers
++
;
return
true
;
}
...
...
@@ -163,9 +166,23 @@ public:
Utils
::
error
()
<<
"Attaching of texture to the FBO failed"
<<
std
::
endl
;
return
false
;
}
mDrawBuffers
++
;
Attachment
attachment
=
{
_name
,
_texture
,
SharedRenderBuffer
()};
mColorAttachments
.
push_back
(
attachment
);
mColorAttachmentIndices
[
_name
]
=
mDrawBuffers
;
mDrawBuffers
++
;
return
true
;
}
inline
bool
setColorRenderBuffer
(
const
std
::
string
_name
,
const
ConstSharedRenderBuffer
&
_renderBuffer
)
{
glFramebufferRenderbuffer
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
+
mColorAttachmentIndices
[
_name
],
GL_RENDERBUFFER
,
_renderBuffer
->
getObjectName
()
);
return
true
;
}
inline
bool
setColorTexture
(
const
std
::
string
_name
,
const
ConstSharedTexture
&
_texture
)
{
glFramebufferTexture2D
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
+
mColorAttachmentIndices
[
_name
],
_texture
->
getTarget
(),
_texture
->
getObjectName
(),
0
);
return
true
;
}
...
...
@@ -208,6 +225,8 @@ protected:
GLuint
mObjectName
;
GLsizei
mDrawBuffers
;
AttachmentVec
mColorAttachments
;
//stores the attachment index (GL_COLOR_ATTACHMENT0 + i) of each color attachment by its name.
std
::
map
<
std
::
string
,
int
>
mColorAttachmentIndices
;
Attachment
mDepthAttachment
;
// depth and stencil are combined
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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