public SampleViewport(UISurfaceViewportControl vw) { this.vw = vw; // var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; this.primaryScreenWorkingAreaW = 800; // workingArea.Width; this.primaryScreenWorkingAreaH = 600; // orkingArea.Height; }
public AppHostNeutral(UISurfaceViewportControl vw) { //--------------------------------------- //this specific for WindowForm viewport //--------------------------------------- _vw = vw; }
public void Close() { if (_surfaceViewport != null) { _surfaceViewport.Close(); _surfaceViewport = null; } _rootGfx = null; }
public void BindSurface(LayoutFarm.UI.UISurfaceViewportControl surfaceViewport) { _myWidth = 800; _myHeight = 600; _surfaceViewport = surfaceViewport; _rootGfx = surfaceViewport.RootGfx; }
public void Close() { _demoBase.CloseDemo(); if (_surfaceViewport != null) { _surfaceViewport.Close(); _surfaceViewport = null; } _rootGfx = null; _glControl = null; }
public override void BindWindowControl(Control windowControl) { _windowControl = (UISurfaceViewportControl)windowControl; SetBaseCanvasViewport(_openGLViewport = new OpenGLCanvasViewport( this.RootGfx, new Size(windowControl.Width, windowControl.Height))); RootGfx.SetPaintDelegates( (r) => { }, //still do nothing this.PaintToOutputWindow); ////-------------------- ////--------------------------------------- //myGLControl.SetGLPaintHandler(HandleGLPaint); //hh1 = miniGLControl.Handle; //miniGLControl.MakeCurrent(); //int max = Math.Max(this.Width, this.Height); //canvas2d = PixelFarm.Drawing.GLES2.GLES2Platform.CreateCanvasGL2d(max, max); //canvasPainter = new GLCanvasPainter(canvas2d, max, max); ////create text printer for opengl ////---------------------- ////1. win gdi based ////var printer = new WinGdiFontPrinter(canvas2d, w, h); ////canvasPainter.TextPrinter = printer; ////---------------------- ////2. raw vxs ////var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter); ////canvasPainter.TextPrinter = printer; ////---------------------- ////3. agg texture based font texture ////var printer = new AggFontPrinter(canvasPainter, w, h); ////canvasPainter.TextPrinter = printer; ////---------------------- ////4. texture atlas based font texture ////------------ ////resolve request font //var printer = new GLBmpGlyphTextPrinter(canvasPainter, YourImplementation.BootStrapWinGdi.myFontLoader); //canvasPainter.TextPrinter = printer; ////-------------------- //openGLViewport.NotifyWindowControlBinding(); #if DEBUG _openGLViewport.dbugOutputWindow = this; #endif this.EvaluateScrollbar(); }
public void CreateMainForm() { int w = 800, h = 600; GlFwForm form1 = new GlFwForm(w, h, "PixelFarm on GLfw and GLES2"); MyRootGraphic myRootGfx = new MyRootGraphic(w, h, s_textServices); var canvasViewport = new UISurfaceViewportControl(); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, InnerViewportKind.GLES); canvasViewport.SetBounds(0, 0, w, h); form1.Controls.Add(canvasViewport); //demoContext2.LoadDemo(new T45_TextureWrap()); //demoContext2.LoadDemo(new T48_MultiTexture()); //demoContext2.LoadDemo(new T107_1_DrawImages()); _demoBase = new OpenTkEssTest.T108_LionFill();//new T45_TextureWrap(),T48_MultiTexture() //_demoBase = new T110_DrawText(); //_demoBase = new T107_1_DrawImages(); _demoContext = new GLDemoContext(w, h); _demoContext.SetTextPrinter(painter => { var printer = new PixelFarm.DrawingGL.GLBitmapGlyphTextPrinter(painter, s_textServices); painter.TextPrinter = printer; //create text printer for opengl //---------------------- //1. win gdi based //var printer = new WinGdiFontPrinter(canvas2d, w, h); //canvasPainter.TextPrinter = printer; //---------------------- //2. raw vxs //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter); //canvasPainter.TextPrinter = printer; //---------------------- //3. agg texture based font texture //var printer = new AggFontPrinter(canvasPainter, w, h); //canvasPainter.TextPrinter = printer; //---------------------- //4. texture atlas based font texture //------------ //resolve request font //var printer = new GLBmpGlyphTextPrinter(canvasPainter, YourImplementation.BootStrapWinGdi.myFontLoader); //canvasPainter.TextPrinter = printer; }); form1.SetDrawFrameDelegate(e => _demoContext.Render()); _demoContext.LoadDemo(_demoBase); }
public void BindSurface(LayoutFarm.UI.UISurfaceViewportControl surfaceViewport) { _surfaceViewport = surfaceViewport; _rootGfx = surfaceViewport.RootGfx; //---------------------- _glControl = surfaceViewport.GetOpenTKControl(); _myWidth = _glControl.Width; _myHeight = _glControl.Height; IntPtr hh1 = _glControl.Handle; //ensure that contrl handler is created _glControl.MakeCurrent(); }
public void CreateMainForm(int w, int h) { GlFwForm form1 = new GlFwForm(w, h, "PixelFarm on GLfw and GLES2"); MyRootGraphic myRootGfx = new MyRootGraphic(w, h, s_textServices); var canvasViewport = new UISurfaceViewportControl(); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, InnerViewportKind.GLES); canvasViewport.SetBounds(0, 0, w, h); form1.Controls.Add(canvasViewport); _surfaceViewport = canvasViewport; LayoutFarm.AppHostNeutral appHost = new LayoutFarm.AppHostNeutral(canvasViewport); form1.SetDrawFrameDelegate(e => { _surfaceViewport.PaintMeFullMode(); }); if (_app != null) { appHost.StartApp(_app);//start app canvasViewport.TopDownRecalculateContent(); canvasViewport.PaintMe(); } }
internal EaseViewport(UISurfaceViewportControl viewportControl) { this.viewportControl = viewportControl; this.sampleViewport = new SampleViewport(viewportControl); }