summaryrefslogtreecommitdiff
path: root/gfx/gl/sceneRenderer.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-02 17:26:23 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-02 17:26:23 +0000
commitb7b5db10f9b99815d8a32fafde27c0c51f7e26d3 (patch)
treeda031c708b90a614bd1f47bf92ba76878c98142f /gfx/gl/sceneRenderer.cpp
parentAdd gl_traits for all the common types (diff)
downloadilt-b7b5db10f9b99815d8a32fafde27c0c51f7e26d3.tar.bz2
ilt-b7b5db10f9b99815d8a32fafde27c0c51f7e26d3.tar.xz
ilt-b7b5db10f9b99815d8a32fafde27c0c51f7e26d3.zip
Single helper for rendering the fullscreen quad
Diffstat (limited to 'gfx/gl/sceneRenderer.cpp')
-rw-r--r--gfx/gl/sceneRenderer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp
index ee6d927..8b299ad 100644
--- a/gfx/gl/sceneRenderer.cpp
+++ b/gfx/gl/sceneRenderer.cpp
@@ -96,9 +96,7 @@ SceneRenderer::render(const SceneProvider & scene) const
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, gIllumination);
lighting.use();
- glBindVertexArray(displayVAO);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- glBindVertexArray(0);
+ renderQuad();
}
void
@@ -119,12 +117,18 @@ SceneRenderer::setDirectionalLight(
glViewport(0, 0, size.x, size.y);
dirLight.use();
dirLight.setDirectionalLight(colour, direction, lvp.projections, lvp.regions);
- glBindVertexArray(displayVAO);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- glBindVertexArray(0);
+ renderQuad();
}
}
+void
+SceneRenderer::renderQuad() const
+{
+ glBindVertexArray(displayVAO);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ glBindVertexArray(0);
+}
+
SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() :
Program {lightingShader_vs, directionalLight_fs}, directionLoc {*this, "lightDirection"},
colourLoc {*this, "lightColour"}, lightViewProjectionLoc {*this, "lightViewProjection"},