public void InitRootGraphics(RootGraphic rootgfx, ITopWindowEventRoot topWinEventRoot, InnerViewportKind innerViewportKind, IGpuOpenGLSurfaceView nativeWindow, AbstractTopWindowBridge bridge) { //create a proper bridge**** _rootgfx = rootgfx; _topWinEventRoot = topWinEventRoot; _innerViewportKind = innerViewportKind; _viewport = nativeWindow; _winBridge = bridge; nativeWindow.SetSize(rootgfx.Width, rootgfx.Height); switch (innerViewportKind) { case InnerViewportKind.GdiPlusOnGLES: case InnerViewportKind.AggOnGLES: case InnerViewportKind.GLES: { _winBridge.OnHostControlLoaded(); try { nativeWindow.MakeCurrent(); } catch (Exception ex) { } int w = nativeWindow.Width; int h = nativeWindow.Height; int max = Math.Max(w, h); _pcx = PixelFarm.DrawingGL.GLPainterCore.Create(max, max, w, h, true); _glPainter = new GLPainter(); _glPainter.BindToPainterCore(_pcx); if (PixelFarm.Drawing.GLES2.GLES2Platform.TextService != null) { var printer = new GLBitmapGlyphTextPrinter(_glPainter, PixelFarm.Drawing.GLES2.GLES2Platform.TextService); _glPainter.TextPrinter = printer; } else { //warn....! } //canvasPainter.SmoothingMode = PixelFarm.Drawing.SmoothingMode.HighQuality; //---------------------- //1. win gdi based //var printer = new WinGdiFontPrinter(canvas2d, view.Width, view.Height); //canvasPainter.TextPrinter = printer; //---------------------- //2. raw vxs //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter); //canvasPainter.TextPrinter = printer; //---------------------- //3. agg texture based font texture //_glPainter.TextPrinter = new CpuBlitTextSpanPrinter2(_glPainter, 400, 50, PixelFarm.Drawing.GLES2.GLES2Platform.TextService); //TODO: review this again! //3 var drawboard = new PixelFarm.Drawing.GLES2.MyGLDrawBoard(_glPainter); _glPainter.SetDrawboard(drawboard); _drawboard = drawboard; //{ //in mixed mode //GDI+ on GLES, Agg on GLES we provide a software rendering layer too PixelFarm.Drawing.DrawBoard cpuDrawBoard = null; // CreateSoftwareDrawBoard(view.Width, view.Height, innerViewportKind); drawboard.SetCpuBlitDrawBoardCreator(() => cpuDrawBoard ?? (cpuDrawBoard = CreateSoftwareDrawBoard(w, h, innerViewportKind))); //} ((OpenGL.MyTopWindowBridgeOpenGL)_winBridge).SetCanvas(drawboard); } break; } }