summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/gameMainWindow.cpp2
-rw-r--r--ui/sceneRenderer.cpp6
-rw-r--r--ui/sceneRenderer.h3
3 files changed, 6 insertions, 5 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index b6e0075..dfb51e9 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -30,7 +30,7 @@ public:
};
GameMainWindow::GameMainWindow(size_t w, size_t h) :
- Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {size}, camera {{-1250.0F, -1250.0F, 35.0F}, quarter_pi, rdiv(w, h),
+ Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {size, 0}, camera {{-1250.0F, -1250.0F, 35.0F}, quarter_pi, rdiv(w, h),
0.1F, 10000.0F}
{
uiComponents.create<ManualCameraController>(glm::vec2 {-1150, -1150});
diff --git a/ui/sceneRenderer.cpp b/ui/sceneRenderer.cpp
index 5ef0379..9432710 100644
--- a/ui/sceneRenderer.cpp
+++ b/ui/sceneRenderer.cpp
@@ -10,7 +10,7 @@ static constexpr std::array<glm::vec4, 4> displayVAOdata {{
{1.0f, 1.0f, 1.0f, 1.0f},
{1.0f, -1.0f, 1.0f, 0.0f},
}};
-SceneRenderer::SceneRenderer(glm::ivec2 size) : lighting {lightingShader_vs, lightingShader_fs}
+SceneRenderer::SceneRenderer(glm::ivec2 size, GLuint o) : output {o}, lighting {lightingShader_vs, lightingShader_fs}
{
glBindVertexArray(displayVAO);
glBindBuffer(GL_ARRAY_BUFFER, displayVBO);
@@ -43,7 +43,7 @@ SceneRenderer::SceneRenderer(glm::ivec2 size) : lighting {lightingShader_vs, lig
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
throw std::runtime_error("Framebuffer not complete!");
}
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_FRAMEBUFFER, output);
}
void
@@ -58,7 +58,7 @@ SceneRenderer::render(std::function<void()> content) const
glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
content();
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_FRAMEBUFFER, output);
// Lighting pass
glDisable(GL_BLEND);
diff --git a/ui/sceneRenderer.h b/ui/sceneRenderer.h
index 6c96418..9352fc9 100644
--- a/ui/sceneRenderer.h
+++ b/ui/sceneRenderer.h
@@ -7,11 +7,12 @@
class SceneRenderer {
public:
- explicit SceneRenderer(glm::ivec2 size);
+ explicit SceneRenderer(glm::ivec2 size, GLuint output);
void render(std::function<void()> content) const;
private:
+ GLuint output;
glFrameBuffer gBuffer;
glTexture gPosition, gNormal, gAlbedoSpec;
glRenderBuffer depth;