void display() { // Clear the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearBufferfv(GL_COLOR, 0, &glm::vec4(1.0f, 0.5f, 0.0f, 1.0f)[0]); // Pass 1: Render the scene in a multisampled framebuffer renderFBO(); // Pass 2: Resolved and render the colorbuffer from the multisampled framebuffer resolveMultisampling(); glf::swapBuffers(); }
bool render() { // Clear the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); // Pass 1 // Render the scene in a multisampled framebuffer glEnable(GL_MULTISAMPLE); renderFBO(); glDisable(GL_MULTISAMPLE); // Pass 2 // Resolved and render the colorbuffer from the multisampled framebuffer resolveMultisampling(); return true; }
void display() { // Clear the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearBufferfv(GL_COLOR, 0, &glm::vec4(1.0f, 0.5f, 0.0f, 1.0f)[0]); // Pass 1 // Render the scene in a multisampled framebuffer glEnable(GL_MULTISAMPLE); renderFBO(FramebufferRenderName); glDisable(GL_MULTISAMPLE); // Pass 2 // Resolved and render the colorbuffer from the multisampled framebuffer resolveMultisampling(); glf::checkError("display"); glf::swapBuffers(); }
bool render() { glm::ivec2 WindowSize(this->getWindowSize()); { glm::mat4 Perspective = glm::perspective(glm::pi<float>() * 0.25f, float(FRAMEBUFFER_SIZE.x) / FRAMEBUFFER_SIZE.y, 0.1f, 100.0f); glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.3f)); glm::mat4 MVP = Perspective * this->view() * Model; *reinterpret_cast<glm::mat4*>(this->UniformPointer + this->UniformBlockSize * 0) = MVP; } { glm::mat4 Perspective = glm::ortho(-4.0f, 4.0f, -3.0f, 3.0f, 0.0f, 100.0f); glm::mat4 ViewFlip = glm::scale(glm::mat4(1.0f), glm::vec3(1.0f, -1.0f, 1.0f)); glm::mat4 View = glm::translate(ViewFlip, glm::vec3(0.0f, 0.0f, -this->cameraDistance() * 2.0)); glm::mat4 Model = glm::mat4(1.0f); glm::mat4 MVP = Perspective * View * Model; *reinterpret_cast<glm::mat4*>(this->UniformPointer + this->UniformBlockSize * 1) = MVP; } // Clear the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); GLenum Buffer = GL_BACK; glDrawBuffers(1, &Buffer); glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); // Pass 1 // Render the scene in a multisampled framebuffer glEnable(GL_MULTISAMPLE); renderFBO(FramebufferName[framebuffer::RENDER]); glDisable(GL_MULTISAMPLE); // Pass 2 // Resolved and render the colorbuffer from the multisampled framebuffer resolveMultisampling(); return true; }