public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) : base(device, presentationParameters) { device.Begin(); device.InitDefaultRenderTarget(presentationParameters); device.End(); backBuffer = device.DefaultRenderTarget; DepthStencilBuffer = device.windowProvidedDepthTexture; }
public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) : base(device, presentationParameters) { device.Begin(); device.InitDefaultRenderTarget(presentationParameters); device.End(); backBuffer = device.DefaultRenderTarget; DepthStencilBuffer = device.windowProvidedDepthTexture; }
public override void Present() { GraphicsDevice.Begin(); // If we made a fake render target to avoid OpenGL limitations on window-provided back buffer, let's copy the rendering result to it if (GraphicsDevice.DefaultRenderTarget != GraphicsDevice.windowProvidedRenderTexture) { GraphicsDevice.Copy(GraphicsDevice.DefaultRenderTarget, GraphicsDevice.windowProvidedRenderTexture); } OpenTK.Graphics.GraphicsContext.CurrentContext.SwapBuffers(); GraphicsDevice.End(); }
/// <summary> /// Resizes the current presenter, by resizing the back buffer and the depth stencil buffer. /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <param name="format"></param> public void Resize(int width, int height, PixelFormat format) { GraphicsDevice.Begin(); Description.BackBufferWidth = width; Description.BackBufferHeight = height; Description.BackBufferFormat = format; ResizeBackBuffer(width, height, format); ResizeDepthStencilBuffer(width, height, format); GraphicsDevice.End(); }
public override void Present() { GraphicsDevice.Begin(); // If we made a fake render target to avoid OpenGL limitations on window-provided back buffer, let's copy the rendering result to it if (backBuffer != GraphicsDevice.windowProvidedRenderTexture) { GraphicsDevice.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(); GraphicsDevice.End(); }