From 5599a39eff7b2ee2b37e29ef7b4c3c60f1722243 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Mon, 9 Mar 2015 08:21:44 +0100 Subject: [PATCH] Reenabling multisampling. --- graphics.cc | 11 +++++++++-- main.cc | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/graphics.cc b/graphics.cc index a01fc1f..b4bf2b6 100644 --- a/graphics.cc +++ b/graphics.cc @@ -41,7 +41,7 @@ void Graphics::init(Level* level) { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); - //glEnable(GL_MULTISAMPLE); + glEnable(GL_MULTISAMPLE); // update lights on creation @@ -288,7 +288,7 @@ void Graphics::render(double time) } // lighting render pass - framebuffer_light->bind(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //wind @@ -360,6 +360,13 @@ void Graphics::render(double time) } glDisable(GL_CULL_FACE); + framebuffer_light->bind(); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_light->getObjectName()); + glBlitFramebuffer(0, 0, windowSize.x, windowSize.y, 0, 0, windowSize.x, windowSize.y, + GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST); + // draw slightly larger only for stencil buffer to blur edges glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, 1, 0xFF); //Set any stencil to 1 diff --git a/main.cc b/main.cc index 00e1c0e..318ed04 100644 --- a/main.cc +++ b/main.cc @@ -87,7 +87,7 @@ bool createWindow() setGLFWHintsForOpenGLVersion( ACGL_OPENGL_VERSION ); // activate multisampling (second parameter is the number of samples): - //glfwWindowHint( GLFW_SAMPLES, 4); + glfwWindowHint( GLFW_SAMPLES, 4); // request an OpenGL debug context: glfwWindowHint( GLFW_OPENGL_DEBUG_CONTEXT, true );