public void Release()
 {
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
     SetVP.Set(0, 0, AppInfo.W, AppInfo.H);
     AppInfo.RW = AppInfo.W;
     AppInfo.RH = AppInfo.H;
 }
Exemple #2
0
        public static void Set(int w, int h)
        {
            GL.ClearColor(System.Drawing.Color.AliceBlue);
            GL.Enable(EnableCap.DepthTest);
            AppInfo.W    = w;
            AppInfo.H    = h;
            AppInfo.RW   = w;
            AppInfo.RH   = h;
            AppInfo.Full = false;
            AppInfo.App  = "GLApp";
            if (!done)
            {
                Import.Import.RegDefaults();
            }
            SetVP.Set(0, 0, w, h);
            GL.Scissor(0, 0, w, h);
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.Disable(EnableCap.StencilTest);
            GL.Disable(EnableCap.ScissorTest);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthRange(0, 1);

            GL.ClearDepth(1.0f);
            GL.DepthFunc(DepthFunction.Less);
            // UI.UISys.ActiveUI.OnResize(Width, Height);
            Pen2D.SetProj(0, 0, w, h);
            if (!done)
            {
                Pen2D.InitDraw();
            }
            AppInfo.W  = w;
            AppInfo.H  = h;
            AppInfo.RW = w;
            AppInfo.RH = h;

            SetVP.Set(0, 0, w, h);
            GL.Scissor(0, 0, w, h);
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.Disable(EnableCap.StencilTest);
            GL.Disable(EnableCap.ScissorTest);
            // GL.Disable(EnableCap.Lighting);

            //GL.DepthFunc(DepthFunction.Greater);

            GL.Enable(EnableCap.DepthTest);
            GL.DepthRange(0, 1);

            GL.ClearDepth(1.0f);
            GL.DepthFunc(DepthFunction.Lequal);

            Pen2D.SetProj(0, 0, w, h);

            done = true;
        }
Exemple #3
0
        public static void DrawQuad()
        {
            if (disableflag == false)
            {
                GL.Disable(EnableCap.CullFace);
                GL.Disable(EnableCap.DepthTest);
                disableflag = true;
            }
            GL.Disable(EnableCap.CullFace);
            GL.Disable(EnableCap.DepthTest);
            SetVP.Set(0, 0, AppInfo.W, AppInfo.H);

            //  GL.Disable(EnableCap.Blend);
            //GL.Disable(EnableCap.)

            // WhiteTex.Bind(0);

            QFX.Bind();

            if (boundva == false)
            {
                boundva = true;
                GL.BindVertexArray(qva);
            }
            if (boundvb == false)
            {
                boundvb = true;
                GL.BindBuffer(BufferTarget.ArrayBuffer, qvb);
            }
            if (boundaa == false)
            {
                //boundaa = true;
                GL.EnableVertexAttribArray(0);
                GL.EnableVertexAttribArray(1);
                GL.EnableVertexAttribArray(2);

                GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 9 * 4, 0);

                GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 9 * 4, 3 * 4);

                GL.VertexAttribPointer(2, 4, VertexAttribPointerType.Float, false, 9 * 4, 5 * 4);
            }

            // GL.DrawElements<uint>(PrimitiveType.Quads, 4, DrawElementsType.UnsignedInt, ind);
            //GL.DrawArrays(PrimitiveType.Quads, 0, 4);
            if (boundin == false)
            {
                GL.BindBuffer(BufferTarget.ElementArrayBuffer, inb);
                // boundin = true;
            }
            GL.DrawElements(BeginMode.Quads, 4, DrawElementsType.UnsignedInt, 0);
            // GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            //   QFX.Release ( );

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);

            // WhiteTex.Release(0);
        }
 public void Bind()
 {
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, FBO);
     SetVP.Set(0, 0, IW, IH);
     AppInfo.RW = IW;
     AppInfo.RH = IH;
     GL.ClearColor(0, 0, 0, 0);
     GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 }
 public TextureTarget SetFace(int face)
 {
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, FBO);
     SetVP.Set(0, 0, W, H);
     App.AppInfo.RW = W;
     App.AppInfo.RH = H;
     GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.TextureCubeMapPositiveX + face, Cube.ID, 0);
     CheckFBO();
     return(TextureTarget.TextureCubeMapPositiveX + face);
 }
Exemple #6
0
        public static void SetSize(int w, int h)
        {
            AppInfo.W  = w;
            AppInfo.H  = h;
            AppInfo.RW = w;
            AppInfo.RH = h;
            SetVP.Set(0, 0, w, h);

            GL.Scissor(0, 0, w, h);
            Pen2D.SetProj(0, 0, w, h);
        }
Exemple #7
0
        public static void DrawQuadBlur(float blur, float refract = 0)
        {
            GL.Disable(EnableCap.CullFace);
            GL.Disable(EnableCap.DepthTest);

            SetVP.Set(0, 0, AppInfo.W, AppInfo.H);
            //  GL.Disable(EnableCap.Blend);
            //GL.Disable(EnableCap.)

            // WhiteTex.Bind(0);

            BFX.Refract = refract;

            BFX.Blur = blur;

            BFX.Bind();

            GL.BindVertexArray(qva);

            GL.BindBuffer(BufferTarget.ArrayBuffer, qvb);
            GL.EnableVertexAttribArray(0);

            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 9 * 4, 0);
            GL.EnableVertexAttribArray(1);
            GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 9 * 4, 3 * 4);
            GL.EnableVertexAttribArray(2);
            GL.VertexAttribPointer(2, 4, VertexAttribPointerType.Float, false, 9 * 4, 5 * 4);

            uint[] ind = new uint[4];
            ind[0] = 0;
            ind[1] = 1;
            ind[2] = 2;
            ind[3] = 3;
            GL.DrawElements <uint>(PrimitiveType.Quads, 4, DrawElementsType.UnsignedInt, ind);
            //GL.DrawArrays(PrimitiveType.Quads, 0, 4);

            GL.DisableVertexAttribArray(0);
            GL.DisableVertexAttribArray(1);
            // GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            BFX.Release();

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
        }