From c3eea71370eb94cff1fd96185458643fab6eb2c5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 3 Nov 2022 19:47:46 +0000 Subject: Restructure how shaders are worked with Needs a tidy-up --- ui/sceneRenderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/sceneRenderer.cpp') diff --git a/ui/sceneRenderer.cpp b/ui/sceneRenderer.cpp index 5e03704..6e75dec 100644 --- a/ui/sceneRenderer.cpp +++ b/ui/sceneRenderer.cpp @@ -10,7 +10,7 @@ static constexpr std::array 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.compile(), lightingShader_fs.compile()} +SceneRenderer::SceneRenderer(glm::ivec2 size) : lighting {lightingShader_vs, lightingShader_fs} { glBindVertexArray(displayVAO); glBindBuffer(GL_ARRAY_BUFFER, displayVBO); @@ -60,7 +60,6 @@ SceneRenderer::render(std::function content) const // Lighting pass glDisable(GL_BLEND); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glUseProgram(lighting.m_program); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gPosition); glActiveTexture(GL_TEXTURE1); @@ -68,6 +67,7 @@ SceneRenderer::render(std::function content) const glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, gAlbedoSpec); // TODO Configure lights + lighting.use(); glBindVertexArray(displayVAO); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindVertexArray(0); -- cgit v1.2.3