示例#1
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.ClearColor(Color4.Red);
            GL.Clear(OpenTK.Graphics.ES20.ClearBufferMask.ColorBufferBit);

            SwapBuffers();
        }
示例#2
0
        private void End20()
        {
            // Disable Blending by default = BlendState.Opaque
            GL20.Disable(All20.Blend);

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

            if (_blendState == BlendState.AlphaBlend)
            {
                GL20.BlendFunc(All20.SrcAlpha, 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);

            GL20.Viewport(0, 0, this.graphicsDevice.Viewport.Width, this.graphicsDevice.Viewport.Height);                       // configura el viewport
            GL20.UseProgram(program);

            if (GraphicsDevice.defaultFramebuffer)
            {
                GL20.CullFace(All20.Back);
                SetUniformMatrix4(uniformWVP, false, ref matWVPScreen);
            }
            else
            {
                GL20.CullFace(All20.Front);
                SetUniformMatrix4(uniformWVP, false, ref matWVPFramebuffer);
                GL20.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
                GL20.Clear((int)(All20.ColorBufferBit | All20.DepthBufferBit));
            }

            _batcher.DrawBatch20(_sortMode);


            GL20.Disable(All20.Texture2D);
        }
示例#3
0
        public void Clear(Color color)
        {
            Vector4 vector = color.ToEAGLColor();

            if (openGLESVersion == GLContextVersion.Gles2_0)
            {
                GL20.ClearColor(vector.X, vector.Y, vector.Z, vector.W);
                GL20.Clear((uint)All20.ColorBufferBit);
            }
            else
            {
                GL11.ClearColor(vector.X, vector.Y, vector.Z, vector.W);
                GL11.Clear((uint)All11.ColorBufferBit);
            }
        }
示例#4
0
 public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
 {
     if (openGLESVersion == GLContextVersion.Gles2_0)
     {
         GL20.ClearColor(color.X, color.Y, color.Z, color.W);
         GL20.ClearDepth(depth);
         GL20.ClearStencil(stencil);
         GL20.Clear((uint)(All20.ColorBufferBit | All20.DepthBufferBit | All20.StencilBufferBit));
     }
     else
     {
         GL11.ClearColor(color.X, color.Y, color.Z, color.W);
         GL11.ClearDepth(depth);
         GL11.ClearStencil(stencil);
         GL11.Clear((uint)(All11.ColorBufferBit | All11.DepthBufferBit | All11.StencilBufferBit));
     }
 }