Example #1
0
        public void Render()
        {
            // GL.Disable(EnableCap.Blend);
            Active = this;

            RBuf.Bind();
            GL.ClearColor(0, 0, 0, 1);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            Scene.Render();
            RBuf.Release();

            GL.Disable(EnableCap.Blend);

            FB.Bind();
            GL.ClearColor(0, 0, 0, 1);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            Scene.Render();
            FB.Release();
            GL.Disable(EnableCap.Blend);
            PBuf = RBuf;
            //GL.DrawBuffer(DrawBufferMode.Back);
            foreach (VPostProcess p in Processes)
            {
                //FB2.Bind ( );
                p.Bind(FB.BB);
                FB2.Bind();
                p.Render(FB.BB);
                FB2.Release();
                p.Release(FB.BB);
                FrameBufferColor ob = null;
                if (p.NeedsPostRender)
                {
                    p.PostBind(FB2.BB);

                    ob  = FB;
                    FB  = FB2;
                    FB2 = ob;

                    FB2.Bind();
                    p.PostRender(FB.BB);
                    FB2.Release();
                    FB2.Release();
                }
                ob  = FB;
                FB  = FB2;
                FB2 = ob;
                //PBuf = FB;
            }

            // GL.Viewport(0, 0, 1024, 768);
            GL.Disable(EnableCap.Blend);
            GL.ClearColor(1.0f, 0.8f, 0.8f, 0.8f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            DrawQuad();
        }
Example #2
0
        public void RenderFinal()
        {
            FinalFB.Bind();

            foreach (var light in Graph.Lights)
            {
                FinalFx.Light = light;

                Draw.IntelliDraw.BeginDraw();

                Draw.IntelliDraw.DrawImg(0, H, W, -H);

                Draw.IntelliDraw.Binder bind = () =>
                {
                    PositionFB.BB.Bind(0);
                    NormalFB.BB.Bind(1);
                    NormalsFB.BB.Bind(2);
                    DiffuseFB.BB.Bind(3);
                };

                Draw.IntelliDraw.EndDraw(FinalFx, bind);

                PositionFB.BB.Release(0);
                NormalFB.BB.Release(1);
                NormalsFB.BB.Release(2);
                DiffuseFB.BB.Release(3);
            }

            FinalFB.Release();
        }
Example #3
0
        public void RenderFinal()
        {
            FinalFB.Bind();

            bool first  = true;
            bool second = true;

            foreach (var light in Graph.Lights)
            {
                if (first)
                {
                    GL.Enable(EnableCap.Blend);
                    GL.BlendFunc(BlendingFactor.One, BlendingFactor.Zero);
                    first = false;
                }
                else if (second)
                {
                    GL.BlendFunc(BlendingFactor.One, BlendingFactor.One);
                    second = false;
                }
                FinalFX.Light = light;

                Draw.IntelliDraw.BeginDraw();

                Draw.IntelliDraw.DrawImg(0, H, W, -H);

                Draw.IntelliDraw.Binder bind = () =>
                {
                    for (int i = 0; i < FB.Targets.Count; i++)
                    {
                        FB.Targets[i].Bind(i);
                    }
                    //PositionFB.BB.Bind(0);
                    //NormalFB.BB.Bind(1);
                    //NormalsFB.BB.Bind(2);
                    //DiffuseFB.BB.Bind(3);
                };

                Draw.IntelliDraw.EndDraw(FinalFX, bind);

                for (int i = 0; i < FB.Targets.Count; i++)
                {
                    FB.Targets[i].Release(i);
                }
            }

            FinalFB.Release();
        }
Example #4
0
        public override void Bind(Texture2D bb)
        {
            ib = bb;
            DFB.Bind( );
            GL.ClearColor(1, 0, 0, 0);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            OutLineGraph.RenderDepth( );

            DFB.Release( );

            GL.Disable(EnableCap.Blend);

            // var tmp = ImageProcessing.ImageProcessor.BlurImage(DFB.BB, 0.9f);

            DFB.BB.Bind(0);
            bb.Bind(1);
            BFX.Bind( );
        }
Example #5
0
        public void Render()
        {
            App.AppInfo.RW = W;
            App.AppInfo.RH = H;

            FXG.Cam = Graph.Cams[0];

            DiffuseFB.Bind();

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            RenderNode(Graph.Root, DiffFx);

            DiffuseFB.Release();

            NormalFB.Bind();

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            RenderNode(Graph.Root, NormFx);

            NormalFB.Release();

            PositionFB.Bind();

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            RenderNode(Graph.Root, PosFx);

            PositionFB.Release();

            NormalsFB.Bind();

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            RenderNode(Graph.Root, NormsFX);

            NormalsFB.Release();

            RenderFinal();
        }