Exemple #1
0
        public void SetViewport(int x, int y, int width, int height)
        {
            x      = Util.Clamp(x, 0, ViewportMax.Width - 2);
            y      = Util.Clamp(y, 0, ViewportMax.Height - 2);
            width  = Util.Clamp(width, 1, ViewportMax.Width - x);
            height = Util.Clamp(height, 1, ViewportMax.Height - y);

            Viewport.X      = x;
            Viewport.Y      = y;
            Viewport.Width  = width;
            Viewport.Height = height;

            if (BackBuffer == null)
            {
                BackBuffer = new ColorBuffer(width, height);
            }
            else
            {
                BackBuffer.SetSize(width, height);
            }

            if (DepthBuffer == null)
            {
                DepthBuffer = new gl.DepthBuffer(width, height);
            }
            else
            {
                DepthBuffer.SetSize(width, height);
            }
        }
Exemple #2
0
 public void ClearContext()
 {
     Viewport       = new Rectangle();
     TargetControl  = null;
     TargetGraphics = null;
     BackBuffer     = null;
     DepthBuffer    = null;
 }
Exemple #3
0
 protected void DisposeBackBuffer()
 {
     if (BackBuffer != null)
     {
         BackBuffer.Dispose();
         BackBuffer = null;
     }
 }
Exemple #4
0
 public void SetViewport(int x, int y, int width, int height)
 {
     ViewPort = new Rectangle(x, y, width, height);
     if (BackBuffer == null)
     {
         BackBuffer = new ColorBuffer(width, height);
     }
     else
     {
         BackBuffer.SetSize(width, height);
     }
 }
Exemple #5
0
        public void SetViewport(int x, int y, int width, int height)
        {
            x      = glm.Clamp(x, 0, ViewportMax.Width - 1);
            y      = glm.Clamp(y, 0, ViewportMax.Height - 1);
            width  = glm.Clamp(width, 1, ViewportMax.Width - x);
            height = glm.Clamp(height, 1, ViewportMax.Height - y);

            DisposeBackBuffer();

            this.Viewport    = new Rectangle(x, y, width, height);
            this.BackBuffer  = new ColorBuffer(Viewport.Width, Viewport.Height);
            this.DepthBuffer = new DepthBuffer(Viewport.Width, Viewport.Height);
        }