protected override void OnGLRender(object sender, EventArgs args) { canvas2d.SmoothMode = CanvasSmoothMode.Smooth; canvas2d.StrokeColor = PixelFarm.Drawing.Color.Blue; canvas2d.ClearColorBuffer(); if (!resInit) { //glbmp = LoadTexture(@"..\logo-dark.jpg"); glbmp = LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg"); resInit = true; } canvas2d.DrawSubImage(glbmp, 10, 10, 100, 100, 200, 400); canvas2d.DrawImage(glbmp, 0, 300); canvas2d.DrawImageWithBlurX(glbmp, 0, 600); miniGLControl.SwapBuffers(); }
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(); }