示例#1
0
 public void Scissor(int x, int y, int width, int height)
 {
     GLES20.Scissor(x, y, width, height);
 }
示例#2
0
        private void EndGL20()
        {
            // Disable Blending by default = BlendState.Opaque
            GL20.Disable(ALL20.Blend);

            // set the blend mode
            if (_blendState == BlendState.NonPremultiplied)
            {
                GL20.BlendFunc(ALL20.SrcAlpha, ALL20.OneMinusSrcAlpha);
                GL20.Enable(ALL20.Blend);
                GL20.BlendEquation(ALL20.FuncAdd);
            }

            if (_blendState == BlendState.AlphaBlend)
            {
                GL20.BlendFunc(ALL20.One, ALL20.OneMinusSrcAlpha);
                GL20.Enable(ALL20.Blend);
                GL20.BlendEquation(ALL20.FuncAdd);
            }

            if (_blendState == BlendState.Additive)
            {
                GL20.BlendFunc(ALL20.SrcAlpha, ALL20.One);
                GL20.Enable(ALL20.Blend);
                GL20.BlendEquation(ALL20.FuncAdd);
            }

            //CullMode
            GL20.FrontFace(ALL20.Cw);
            GL20.Enable(ALL20.CullFace);


            UpdateWorldMatrixOrientation();

            // Configure ViewPort
            var client = Game.Instance.Window.ClientBounds;

            GL20.Viewport(client.X, client.Y, client.Width, client.Height);
            GL20.UseProgram(program);

            // Enable Scissor Tests if necessary
            if (this.graphicsDevice.RasterizerState.ScissorTestEnable)
            {
                GL20.Enable(ALL20.ScissorTest);
                GL20.Scissor(this.graphicsDevice.ScissorRectangle.X, this.graphicsDevice.ScissorRectangle.Y, this.graphicsDevice.ScissorRectangle.Width, this.graphicsDevice.ScissorRectangle.Height);
            }

            if (GraphicsDevice.DefaultFrameBuffer)
            {
                GL20.CullFace(ALL20.Back);
                SetUniformMatrix(uniformWVP, false, ref matWVPScreen);
            }
            else
            {
                GL20.CullFace(ALL20.Front);
                SetUniformMatrix(uniformWVP, false, ref matWVPFramebuffer);

                // FIXME: Why clear the framebuffer during End?
                //        Doing so makes it so that only the
                //        final Begin/End pair in a frame can
                //        ever be shown.  Is that desirable?
                //GL20.ClearColor(0.0f,0.0f,0.0f,0.0f);
                //GL20.Clear((int) (ALL20.ColorBufferBit | ALL20.DepthBufferBit));
            }

            _batcher.DrawBatchGL20(_sortMode, _samplerState);

            if (this.graphicsDevice.RasterizerState.ScissorTestEnable)
            {
                GL20.Disable(ALL20.ScissorTest);
            }

            GL20.Disable(ALL20.Texture2D);
        }