Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scigl_render
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RoboGuide
scigl_render
Commits
ff49f339
Commit
ff49f339
authored
Mar 4, 2019
by
Tim Übelhör
Browse files
Options
Downloads
Patches
Plain Diff
using texture as framebuffer attachment so sampling in shaders is possible
parent
32be141c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/scigl_render/buffer/frame_buffer.hpp
+6
-3
6 additions, 3 deletions
include/scigl_render/buffer/frame_buffer.hpp
src/buffer/frame_buffer.cpp
+11
-6
11 additions, 6 deletions
src/buffer/frame_buffer.cpp
with
17 additions
and
9 deletions
include/scigl_render/buffer/frame_buffer.hpp
+
6
−
3
View file @
ff49f339
...
...
@@ -41,6 +41,9 @@ public:
*/
void
clear
(
float
color
=
0
,
float
depth
=
1
,
int
stencil
=
0
)
const
;
/** returns the texture used for rendering */
GLuint
get_texture
()
const
;
/** gets the maximum rbo size */
static
int
get_max_size
();
...
...
@@ -49,9 +52,9 @@ private:
int
width
,
height
;
// framebuffer object to render the texture into
GLuint
fbo
;
//
renderbuffer
for renderng colors
GLuint
color_
rbo
;
// renderbuffer object for the depth testing
//
texture
for renderng colors
, can be sampled from
GLuint
color_
tex
;
// renderbuffer object for the depth testing
, does not allow sampling
GLuint
depth_stencil_rbo
;
};
}
// namespace scigl_render
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/buffer/frame_buffer.cpp
+
11
−
6
View file @
ff49f339
...
...
@@ -10,11 +10,11 @@ FrameBuffer::FrameBuffer(int width, int height, GLenum internal_format)
// Create framebuffer with renderbuffer attachements
glGenFramebuffers
(
1
,
&
fbo
);
activate
();
glGen
Renderbuffer
s
(
1
,
&
color_
rbo
);
glBind
Renderbuffer
(
GL_RENDERBUFFER
,
color_
rbo
);
gl
Renderbuffer
Storage
(
GL_
RENDERBUFFER
,
internal_format
,
width
,
height
);
glFramebuffer
Renderbuffer
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
,
GL_RENDERBUFFER
,
color_
rbo
);
glGen
Texture
s
(
1
,
&
color_
tex
);
glBind
Texture
(
GL_TEXTURE_2D
,
color_
tex
);
gl
Tex
Storage
2D
(
GL_
TEXTURE_2D
,
1
,
internal_format
,
width
,
height
);
glFramebuffer
Texture2D
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
,
GL_TEXTURE_2D
,
color_
tex
,
0
);
glGenRenderbuffers
(
1
,
&
depth_stencil_rbo
);
glBindRenderbuffer
(
GL_RENDERBUFFER
,
depth_stencil_rbo
);
glRenderbufferStorage
(
GL_RENDERBUFFER
,
GL_DEPTH24_STENCIL8
,
width
,
height
);
...
...
@@ -33,7 +33,7 @@ FrameBuffer::~FrameBuffer()
{
glBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
glDeleteRenderbuffers
(
1
,
&
depth_stencil_rbo
);
glDelete
Renderbuffer
s
(
1
,
&
color_
rbo
);
glDelete
Texture
s
(
1
,
&
color_
tex
);
}
void
FrameBuffer
::
activate
()
const
...
...
@@ -56,6 +56,11 @@ void FrameBuffer::clear(float color, float depth, int stencil) const
deactivate
();
}
GLuint
FrameBuffer
::
get_texture
()
const
{
return
color_tex
;
}
int
FrameBuffer
::
get_max_size
()
{
int
max_rbo_size
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment