void FXAA::setAsSurface() { static GLfloat fxaaBg[4] = { 0.5f, 0.5f, 0.f, 1.f }; glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); glClearNamedFramebufferfv(m_fbo, GL_COLOR, 0, fxaaBg); glClearNamedFramebufferfv(m_fbo, GL_DEPTH, 0, &defaultDepth); }
void renderFB() { glm::vec2 WindowSize(this->getWindowSize()); glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE); glViewportIndexedf(0, 0, 0, WindowSize.x, WindowSize.y); glClearNamedFramebufferfv(0, GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindBufferRange(GL_UNIFORM_BUFFER, semantic::uniform::TRANSFORM0, BufferName[buffer::TRANSFORM], this->UniformBlockSize, this->UniformBlockSize); glBindTextureUnit(0, TextureName[texture::COLORBUFFER]); glBindVertexArray(VertexArrayName); glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, ElementCount, GL_UNSIGNED_SHORT, nullptr, 1, 0, 0); }
void renderFBO() { glEnable(GL_MULTISAMPLE); glEnable(GL_SAMPLE_SHADING); glMinSampleShading(4.0f); glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE); glViewportIndexedf(0, 0, 0, static_cast<float>(FRAMEBUFFER_SIZE.x), static_cast<float>(FRAMEBUFFER_SIZE.y)); glClearNamedFramebufferfv(FramebufferName[framebuffer::RENDER], GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName[framebuffer::RENDER]); glBindBufferRange(GL_UNIFORM_BUFFER, semantic::uniform::TRANSFORM0, BufferName[buffer::TRANSFORM], 0, this->UniformBlockSize); glBindSamplers(0, 1, &SamplerName); glBindTextureUnit(0, TextureName[texture::TEXTURE]); glBindVertexArray(VertexArrayName); glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, ElementCount, GL_UNSIGNED_SHORT, nullptr, 1, 0, 0); glDisable(GL_MULTISAMPLE); }
void GLFramebufferObject::clearDepth( int drawbufferIndex, float depth ) { glClearNamedFramebufferfv( m_id, GL_DEPTH, 0, &depth ); }
void GLFramebufferObject::clearColor( int drawbufferIndex, const Vector4f& color ) { Vector4f c = color; glClearNamedFramebufferfv( m_id, GL_COLOR, GL_DRAW_BUFFER0 + drawbufferIndex, c ); }