Example #1
0
        public TextureContent GetTexture()
        {
            GLDebug.CheckAccess();

            framePixels = framePixels ?? new byte[Width * Height * 4];
            GL.ReadPixels(0, 0, Width, Height, PixelFormat.Bgra, PixelType.UnsignedByte, framePixels);
            return(new TextureContent(Width, Height, framePixels));
        }
Example #2
0
        public bool BeginFrame()
        {
            GLDebug.CheckAccess();

            window.ProcessEvents();

            if (window.IsExiting)
            {
                return(false);
            }

            GL.Viewport(0, 0, Width, Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            return(true);
        }
Example #3
0
        public GraphicsHost(GameWindow window, bool hidden = false)
        {
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }

            GLDebug.CheckAccess();

            this.window = window;
            if (!hidden)
            {
                this.window.Visible = true;
            }

            GL.ClearColor(System.Drawing.Color.CornflowerBlue);
        }
Example #4
0
        public void Dispose()
        {
            GLDebug.CheckAccess();

            window?.Dispose();
        }
Example #5
0
        public void EndFrame()
        {
            GLDebug.CheckAccess();

            window?.SwapBuffers();
        }