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
        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);
        }
Exemple #4
0
        public void Clear()
        {
            ModelMatrix      = mat4.Identity;
            ViewMatrix       = mat4.Identity;
            ProjectionMatrix = mat4.Identity;

            DisposeBackBuffer();
            SetTarget(null);
            DepthBuffer      = null;
            m_PrimiteContext = null;

            bDrawWrireframe = true;
            bDrawPrimitive  = true;

            TextureBlendFactor = 0.75f;
        }