/// <inheritdoc /> public override void CopyRenderTarget(RenderTarget source, RenderTarget dest, Rectangle?sourceRect = null, Rectangle?destRect = null, bool smooth = false) { GLThread.ExecuteGLThread(() => { RenderTarget srcTarget = source ?? Engine.Renderer.BaseTarget; RenderTarget destTarget = dest ?? Engine.Renderer.BaseTarget; Vector2 sourceSize = srcTarget.Size; Vector2 destSize = destTarget.Size; Rectangle srcRect = sourceRect ?? new Rectangle(0, 0, sourceSize); Rectangle dstRect = destRect ?? new Rectangle(0, 0, destSize); uint srcPointer = (uint)((GlRenderTarget)srcTarget)?.Pointer; uint destPointer = (uint)((GlRenderTarget)destTarget)?.Pointer; Gl.BindFramebuffer(FramebufferTarget.ReadFramebuffer, srcPointer); Gl.BindFramebuffer(FramebufferTarget.DrawFramebuffer, destPointer); Gl.BlitFramebuffer((int)srcRect.X, (int)srcRect.Y, (int)srcRect.Width, (int)srcRect.Height, (int)dstRect.X, (int)dstRect.Y, (int)dstRect.Width, (int)dstRect.Height, ClearBufferMask.ColorBufferBit, smooth ? BlitFramebufferFilter.Linear : BlitFramebufferFilter.Nearest); // Restore bindings and so on. Engine.Renderer.EnsureRenderTarget(); }); }