public override void EndDraw(CommandList commandList, bool present) { if (present) { // If we made a fake render target to avoid OpenGL limitations on window-provided back buffer, let's copy the rendering result to it commandList.CopyScaler2D(backBuffer, GraphicsDevice.WindowProvidedRenderTexture, new Rectangle(0, 0, backBuffer.Width, backBuffer.Height), new Rectangle(0, 0, GraphicsDevice.WindowProvidedRenderTexture.Width, GraphicsDevice.WindowProvidedRenderTexture.Height), true); gameWindow.SwapBuffers(); } }
public override void EndDraw(CommandList commandList, bool present) { if (present) { // If we made a fake render target to avoid OpenGL limitations on window-provided back buffer, let's copy the rendering result to it commandList.CopyScaler2D(backBuffer, GraphicsDevice.WindowProvidedRenderTexture, new Rectangle(0, 0, backBuffer.Width, backBuffer.Height), new Rectangle(0, 0, GraphicsDevice.WindowProvidedRenderTexture.Width, GraphicsDevice.WindowProvidedRenderTexture.Height), true); // On macOS, `SwapBuffers` will swap whatever framebuffer is active and in our case it is not the window provided // framebuffer, and in addition if the active framebuffer is single buffered, it won't do anything. Forcing a bind // will ensure the window is updated. GL.BindFramebuffer(FramebufferTarget.Framebuffer, GraphicsDevice.WindowProvidedFrameBuffer); OpenTK.Graphics.GraphicsContext.CurrentContext.SwapBuffers(); } }