clear backbuffer when attaching

This commit is contained in:
itsmattkc
2019-08-31 17:25:42 +10:00
parent ff02b41cdc
commit ae48cb072d
+15
View File
@@ -86,18 +86,33 @@ void RenderFramebuffer::Release()
void RenderFramebuffer::Attach(RenderTexturePtr texture)
{
if (context_ == nullptr) {
return;
}
texture_ = texture;
AttachInternal(texture_->texture());
}
void RenderFramebuffer::AttachBackBuffer(RenderTexturePtr texture)
{
if (context_ == nullptr) {
return;
}
texture_ = texture;
AttachInternal(texture_->back_texture());
context_->functions()->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
context_->functions()->glClear(GL_COLOR_BUFFER_BIT);
}
void RenderFramebuffer::Detach()
{
if (context_ == nullptr) {
return;
}
QOpenGLFunctions* f = context_->functions();
// bind framebuffer for attaching