コード例 #1
0
 protected override void OnGLRender(object sender, EventArgs args)
 {
     canvas2d.SmoothMode  = CanvasSmoothMode.Smooth;
     canvas2d.StrokeColor = PixelFarm.Drawing.Color.Blue;
     canvas2d.Clear(PixelFarm.Drawing.Color.White);
     canvas2d.ClearColorBuffer();
     //-------------------------------
     if (!isInit)
     {
         glbmp  = LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg");
         isInit = true;
     }
     if (frameBuffer.FrameBufferId > 0)
     {
         if (frameBufferNeedUpdate)
         {
             //------------------------------------------------------------------------------------
             //framebuffer
             canvas2d.AttachFrameBuffer(frameBuffer);
             //after make the frameBuffer current
             //then all drawing command will apply to frameBuffer
             //do draw to frame buffer here
             canvas2d.Clear(PixelFarm.Drawing.Color.Red);
             canvas2d.DrawImageWithBlurX(glbmp, 0, 300);
             canvas2d.DetachFrameBuffer();
             //------------------------------------------------------------------------------------
             //framebuffer2
             canvas2d.AttachFrameBuffer(frameBuffer2);
             GLBitmap bmp2 = new GLBitmap(frameBuffer.TextureId, frameBuffer.Width, frameBuffer.Height);
             bmp2.IsBigEndianPixel = true;
             canvas2d.DrawImageWithBlurY(bmp2, 0, 300);
             canvas2d.DetachFrameBuffer();
             //------------------------------------------------------------------------------------
             //after release current, we move back to default frame buffer again***
             frameBufferNeedUpdate = false;
         }
         canvas2d.DrawFrameBuffer(frameBuffer2, 15, 300);
     }
     else
     {
         canvas2d.Clear(PixelFarm.Drawing.Color.Blue);
     }
     //-------------------------------
     miniGLControl.SwapBuffers();
 }
コード例 #2
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            canvas2d.SmoothMode  = CanvasSmoothMode.Smooth;
            canvas2d.StrokeColor = PixelFarm.Drawing.Color.Blue;
            canvas2d.Clear(PixelFarm.Drawing.Color.White);
            canvas2d.ClearColorBuffer();
            //-------------------------------
            if (!isInit)
            {
                glbmp  = LoadTexture(RootDemoPath.Path + @"\leaves.jpg");
                isInit = true;
            }
            if (frameBuffer.FrameBufferId > 0)
            {
                if (frameBufferNeedUpdate)
                {
                    //------------------------------------------------------------------------------------
                    //framebuffer
                    canvas2d.AttachFrameBuffer(frameBuffer);
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    canvas2d.Clear(PixelFarm.Drawing.Color.Red);
                    canvas2d.DrawImageWithConv3x3(glbmp, Mat3x3ConvGen.emboss, 0, 300);
                    canvas2d.DetachFrameBuffer();

                    //after release current, we move back to default frame buffer again***
                    frameBufferNeedUpdate = false;
                }
                canvas2d.DrawFrameBuffer(frameBuffer, 15, 300);
            }
            else
            {
                canvas2d.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            miniGLControl.SwapBuffers();
        }