Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Interactive Wave Simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
Interactive Wave Simulator
Commits
8fe10d56
Commit
8fe10d56
authored
4 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up framebuffers
parent
5b089076
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/program
+0
-0
0 additions, 0 deletions
build/program
src/main.cpp
+5
-38
5 additions, 38 deletions
src/main.cpp
with
5 additions
and
38 deletions
build/program
+
0
−
0
View file @
8fe10d56
No preview for this file type
This diff is collapsed.
Click to expand it.
src/main.cpp
+
5
−
38
View file @
8fe10d56
...
@@ -148,39 +148,6 @@ int main(int argc, char** argv){
...
@@ -148,39 +148,6 @@ int main(int argc, char** argv){
//-----------------------
//Framebuffer 3 setup
//-----------------------
unsigned
int
framebuffer3
;
glGenFramebuffers
(
1
,
&
framebuffer3
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
framebuffer3
);
//texture for attachment
unsigned
int
fb_texture3
;
glGenTextures
(
1
,
&
fb_texture3
);
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture3
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
GL_RGBA32F
,
TEXWIDTH
,
TEXHEIGHT
,
0
,
GL_RGBA
,
GL_FLOAT
,
texData
.
data
());
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP_TO_EDGE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP_TO_EDGE
);
//attach texture to framebuffer
glFramebufferTexture2D
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
,
GL_TEXTURE_2D
,
fb_texture3
,
0
);
//check framebuffer
if
(
glCheckFramebufferStatus
(
GL_FRAMEBUFFER
)
!=
GL_FRAMEBUFFER_COMPLETE
)
std
::
cout
<<
"ERROR::FRAMEBUFFER:: Framebuffer 3 is not complete!"
<<
std
::
endl
;
//unbind framebuffer
glBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
...
@@ -349,7 +316,7 @@ int main(int argc, char** argv){
...
@@ -349,7 +316,7 @@ int main(int argc, char** argv){
//Rendering
//Rendering
//-----------------------
//-----------------------
//Step 1
//Step 1
glBindFramebuffer
(
GL_FRAMEBUFFER
,
framebuffer
3
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
framebuffer
1
);
//SDL_GetWindowSize(infra.window(), &w_width, &w_height);
//SDL_GetWindowSize(infra.window(), &w_width, &w_height);
glViewport
(
0
,
0
,
TEXWIDTH
,
TEXHEIGHT
);
glViewport
(
0
,
0
,
TEXWIDTH
,
TEXHEIGHT
);
glClearColor
(
0.1
f
,
0.1
f
,
0.2
f
,
1.0
f
);
glClearColor
(
0.1
f
,
0.1
f
,
0.2
f
,
1.0
f
);
...
@@ -357,7 +324,7 @@ int main(int argc, char** argv){
...
@@ -357,7 +324,7 @@ int main(int argc, char** argv){
shader_step
.
use
();
shader_step
.
use
();
shader_step
.
setFloat
(
"t"
,
time
);
shader_step
.
setFloat
(
"t"
,
time
);
glActiveTexture
(
GL_TEXTURE0
);
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
1
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
2
);
glActiveTexture
(
GL_TEXTURE1
);
glActiveTexture
(
GL_TEXTURE1
);
glBindTexture
(
GL_TEXTURE_2D
,
damping_texture
);
glBindTexture
(
GL_TEXTURE_2D
,
damping_texture
);
glBindVertexArray
(
VAO_tex
);
glBindVertexArray
(
VAO_tex
);
...
@@ -367,7 +334,7 @@ int main(int argc, char** argv){
...
@@ -367,7 +334,7 @@ int main(int argc, char** argv){
//Step 2
//Step 2
glBindFramebuffer
(
GL_FRAMEBUFFER
,
framebuffer
1
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
framebuffer
2
);
//SDL_GetWindowSize(infra.window(), &w_width, &w_height);
//SDL_GetWindowSize(infra.window(), &w_width, &w_height);
glViewport
(
0
,
0
,
TEXWIDTH
,
TEXHEIGHT
);
glViewport
(
0
,
0
,
TEXWIDTH
,
TEXHEIGHT
);
glClearColor
(
0.1
f
,
0.1
f
,
0.2
f
,
1.0
f
);
glClearColor
(
0.1
f
,
0.1
f
,
0.2
f
,
1.0
f
);
...
@@ -375,7 +342,7 @@ int main(int argc, char** argv){
...
@@ -375,7 +342,7 @@ int main(int argc, char** argv){
shader_step
.
use
();
shader_step
.
use
();
shader_step
.
setFloat
(
"t"
,
time
);
shader_step
.
setFloat
(
"t"
,
time
);
glActiveTexture
(
GL_TEXTURE0
);
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
3
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
1
);
glActiveTexture
(
GL_TEXTURE1
);
glActiveTexture
(
GL_TEXTURE1
);
glBindTexture
(
GL_TEXTURE_2D
,
damping_texture
);
glBindTexture
(
GL_TEXTURE_2D
,
damping_texture
);
glBindVertexArray
(
VAO_tex
);
glBindVertexArray
(
VAO_tex
);
...
@@ -400,7 +367,7 @@ int main(int argc, char** argv){
...
@@ -400,7 +367,7 @@ int main(int argc, char** argv){
//shader_copy.use();
//shader_copy.use();
shader_copyred
.
use
();
shader_copyred
.
use
();
glActiveTexture
(
GL_TEXTURE0
);
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
1
);
glBindTexture
(
GL_TEXTURE_2D
,
fb_texture
2
);
//glBindVertexArray(VAO_screen);
//glBindVertexArray(VAO_screen);
//glBindTexture(GL_TEXTURE_2D, damping_texture);
//glBindTexture(GL_TEXTURE_2D, damping_texture);
glBindVertexArray
(
VAO_tex
);
glBindVertexArray
(
VAO_tex
);
...
...
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