Ejemplo n.º 1
0
        private void ApplyScissorTest(ScissorTest scissorTest)
        {
            Rectangle rectangle = scissorTest.Rectangle;

            if (rectangle.Width < 0)
            {
                throw new ArgumentOutOfRangeException(
                          "renderState.ScissorTest.Rectangle.Width must be greater than or equal to zero.",
                          "renderState");
            }

            if (rectangle.Height < 0)
            {
                throw new ArgumentOutOfRangeException(
                          "renderState.ScissorTest.Rectangle.Height must be greater than or equal to zero.",
                          "renderState");
            }

            if (_renderState.ScissorTest.Enabled != scissorTest.Enabled)
            {
                Enable(EnableCap.ScissorTest, scissorTest.Enabled);
                _renderState.ScissorTest.Enabled = scissorTest.Enabled;
            }

            if (scissorTest.Enabled)
            {
                if (_renderState.ScissorTest.Rectangle != scissorTest.Rectangle)
                {
                    GL.Scissor(rectangle.Left, rectangle.Bottom, rectangle.Width, rectangle.Height);
                    _renderState.ScissorTest.Rectangle = scissorTest.Rectangle;
                }
            }
        }
Ejemplo n.º 2
0
        private void ApplyScissorTest(ScissorTest scissorTest)
        {
            Rectangle rectangle = scissorTest.Rectangle;

            if (rectangle.Width < 0)
            {
                throw new ArgumentOutOfRangeException(
                    "renderState.ScissorTest.Rectangle.Width must be greater than or equal to zero.", 
                    "renderState");
            }

            if (rectangle.Height < 0)
            {
                throw new ArgumentOutOfRangeException(
                    "renderState.ScissorTest.Rectangle.Height must be greater than or equal to zero.",
                    "renderState");
            }

            if (_renderState.ScissorTest.Enabled != scissorTest.Enabled)
            {
                Enable(EnableCap.ScissorTest, scissorTest.Enabled);
                _renderState.ScissorTest.Enabled = scissorTest.Enabled;
            }

            if (scissorTest.Enabled)
            {
                if (_renderState.ScissorTest.Rectangle != scissorTest.Rectangle)
                {
                    GL.Scissor(rectangle.Left, rectangle.Bottom, rectangle.Width, rectangle.Height);
                    _renderState.ScissorTest.Rectangle = scissorTest.Rectangle;
                }
            }
        }