bool render() { glm::vec2 WindowSize(this->getWindowSize()); { glm::mat4 ProjectionA = glm::scale(glm::perspective(glm::pi<float>() * 0.25f, float(FRAMEBUFFER_SIZE.x) / FRAMEBUFFER_SIZE.y, 0.1f, 100.0f), glm::vec3(1, -1, 1)); *reinterpret_cast<glm::mat4*>(this->UniformPointer + 0) = ProjectionA * this->view() * glm::mat4(1); glm::mat4 ProjectionB = glm::perspective(glm::pi<float>() * 0.25f, WindowSize.x / WindowSize.y, 0.1f, 100.0f); *reinterpret_cast<glm::mat4*>(this->UniformPointer + this->UniformBlockSize) = ProjectionB * this->view() * glm::scale(glm::mat4(1), glm::vec3(2)); } // Step 1, render the scene in a multisampled framebuffer glBindProgramPipeline(PipelineName); renderFBO(); // Step 2: blit glBlitNamedFramebuffer(FramebufferName[framebuffer::RENDER], FramebufferName[framebuffer::RESOLVE], 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, GL_COLOR_BUFFER_BIT, GL_NEAREST); GLenum MaxColorAttachment = GL_COLOR_ATTACHMENT0; glInvalidateNamedFramebufferData(FramebufferName[framebuffer::RENDER], 1, &MaxColorAttachment); // Step 3, render the colorbuffer from the multisampled framebuffer renderFB(); return true; }
void AbstractFramebuffer::invalidateImplementationDSA(const GLsizei count, const GLenum* const attachments) { glInvalidateNamedFramebufferData(_id, count, attachments); }