From c5ee77e9695594bd12a467ce2bca81e8db56a329 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 25 Apr 2021 01:27:32 +0200 Subject: [PATCH] Fixed blit of framebuffer --- FrameBuffer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 366f211..06423d3 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -227,13 +227,17 @@ void FrameBuffer::readPixels(uint8_t *target_data) bool FrameBuffer::blit(FrameBuffer *destination) { - if (!framebufferid_ || !destination) + if (!framebufferid_ || !destination || (use_alpha_ != destination->use_alpha_) ) return false; if (!destination->framebufferid_) destination->init(); - glBindFramebuffer(GL_READ_FRAMEBUFFER, framebufferid_); + if (use_multi_sampling_) + glBindFramebuffer(GL_READ_FRAMEBUFFER, intermediate_framebufferid_); + else + glBindFramebuffer(GL_READ_FRAMEBUFFER, framebufferid_); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, destination->framebufferid_); // blit to the frame buffer object glBlitFramebuffer(0, 0, attrib_.viewport.x, attrib_.viewport.y,