void blitColor(const GLFramebuffer& source, int src_attachment, const GLFramebuffer* destination, int dst_attachment) { int destination_id = destination ? destination->id() : 0; glNamedFramebufferReadBuffer(source.id(), GL_COLOR_ATTACHMENT0 + src_attachment); if (destination) glNamedFramebufferDrawBuffer(destination_id, GL_COLOR_ATTACHMENT0 + dst_attachment); glBlitNamedFramebuffer(source.id(), destination_id, 0, 0, source.width(), source.height(), 0, 0, source.width(), source.height(), GL_COLOR_BUFFER_BIT, GL_NEAREST); }
virtual void run(GLEngine& glEngine) const { // Create framebuffer if not yet existing GLFramebuffer* fb = mBuff->mFramebuffer; int w = mBuff->mW, h = mBuff->mH; if (fb == nullptr) { fb = new GLFramebuffer(w, h); mBuff->mFramebuffer = fb; } // Bind framebuffer fb->Bind(); g_GLDraw.DrawStretched(0, 0, w, h, &g_GLContextManager.GetBufTex(), 0, 0, w, h, 1.0f); // Bind old framebuffer g_GLContextManager.BindFramebuffer(); }
virtual void run(GLEngine& glEngine) const { if (!g_GLContextManager.IsInitialized()) return; // Create framebuffer if not yet existing mBuff->EnsureFramebufferExists(); GLFramebuffer* fb = mBuff->mFramebuffer; if (fb != nullptr) { int w = mBuff->mW, h = mBuff->mH; // Bind framebuffer fb->Bind(); g_GLDraw.DrawStretched(0, 0, w, h, &g_GLContextManager.GetBufTex(), 0, 0, w, h, 1.0f); // Bind old framebuffer g_GLContextManager.BindFramebuffer(); } }