public override void AttachToBackBuffer(DrawboardBuffer backbuffer) { #if DEBUG if (dbugSwitchCount > 0) { } dbugSwitchCount++; #endif //save prev context SaveContext prevContext = new SaveContext(); prevContext.prevClipRect = _currentClipRect; prevContext.prevCanvasOrgX = _canvasOriginX; prevContext.prevCanvasOrgY = _canvasOriginY; prevContext.prevGLRenderSurface = _gpuPainter.PainterContext.CurrentRenderSurface; _saveContexts.Push(prevContext); //_prevClipRect = _currentClipRect; _currentClipRect = new Rectangle(0, 0, backbuffer.Width, backbuffer.Height); MyGLBackbuffer glBackBuffer = (MyGLBackbuffer)backbuffer; _gpuPainter.PainterContext.AttachToRenderSurface(glBackBuffer.RenderSurface); _gpuPainter.PainterContext.OriginKind = RenderSurfaceOrientation.LeftTop; _gpuPainter.UpdatePainterContext(); _left = 0; _top = 0; _width = _gpuPainter.Width; _height = _gpuPainter.Height; //_prevCanvasOrgX = _canvasOriginX; //_prevCanvasOrgY = _canvasOriginY; _canvasOriginX = 0; _canvasOriginY = 0; _gpuPainter.SetOrigin(0, 0); SetClipRect(_currentClipRect); }