Beispiel #1
0
 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;
 }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        /// <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();
        }