public MainForm(GraphicsBackend backend, string exeDir, string shaderSubdir) { InitializeComponent(); Shown += (sender, e) => FormReady = true; GraphicsDeviceOptions options = new( false, Veldrid.PixelFormat.R32_Float, false, ResourceBindingModel.Improved); Surface = new VeldridSurface(backend, options); Surface.VeldridInitialized += (sender, e) => VeldridReady = true; Content = Surface; ovpSettings = new OVPSettings(); ovpSettings.drawFilled(true); ovpSettings.drawDrawn(true); ovpSettings.drawPoints(true); addPolys(); Driver = new VeldridDriver(ref ovpSettings, ref Surface) { Surface = Surface, ExecutableDirectory = exeDir, ShaderSubdirectory = shaderSubdir }; // TODO: Make this binding actually work both ways. CmdAnimate.Bind <bool>("Checked", Driver, "Animate"); CmdClockwise.Bind <bool>("Checked", Driver, "Clockwise"); }
public MainForm(GraphicsBackend backend) { InitializeComponent(); Shown += (sender, e) => FormReady = true; // A depth buffer isn't strictly necessary for this project, which uses // only 2D vertex coordinates, but it's helpful to create one for the // sake of demonstration. // // The "improved" resource binding model changes how resource slots are // assigned in the Metal backend, allowing it to work like the others, // so the numbers used in calls to CommandList.SetGraphicsResourceSet // will make more sense to developers used to e.g. OpenGL or Direct3D. var options = new GraphicsDeviceOptions( false, PixelFormat.R32_Float, false, ResourceBindingModel.Improved); Surface = new VeldridSurface(backend, options); Surface.Size = new Eto.Drawing.Size(200, 200); Surface.VeldridInitialized += (sender, e) => VeldridReady = true; Content = Surface; Driver = new VeldridDriver { Surface = Surface }; // TODO: Make this binding actually work both ways. CmdAnimate.Bind <bool>("Checked", Driver, "Animate"); CmdClockwise.Bind <bool>("Checked", Driver, "Clockwise"); }
public static void Main(string[] args) { VeldridSurface.InitializeOpenTK(); var platform = new Eto.Wpf.Platform(); new Application(platform).Run(new MainForm()); }
public VeldridView() { Shown += VeldridView_Shown; var gdOptions = new GraphicsDeviceOptions( false, PixelFormat.R32_Float, false, ResourceBindingModel.Improved); var surface = new VeldridSurface(VeldridSurface.PreferredBackend, gdOptions); surface.VeldridInitialized += (sender, e) => VeldridReady = true; surface.Draw += (sender, e) => Refresh(); Content = surface; }
public MainForm() { InitializeComponent(); vlsMapDisplay = new VeldridSurface( VeldridSurface.PreferredBackend, new GraphicsDeviceOptions( false, PixelFormat.R32_Float, false, ResourceBindingModel.Improved)); Shown += (sender, e) => FormReady = true; vlsMapDisplay.VeldridInitialized += (sender, e) => VeldridReady = true; vlsMapDisplay.Size = new Eto.Drawing.Size(200, 200); rtaFileContents.SelectionChanged += RtaFileContents_SelectionChanged; splMain = new Splitter { Orientation = Orientation.Horizontal, Panel1 = rtaFileContents, Panel1MinimumSize = 64, Panel2 = vlsMapDisplay, Panel2MinimumSize = 64 }; //var tblMain = new TableLayout(2, 1); //tblMain.Spacing = new Eto.Drawing.Size(10, 0); // //tblMain.Add(rtaFileContents, 0, 0); //tblMain.Add(vlsMapDisplay, 1, 0); Content = splMain; CmdOpen.Executed += CmdOpen_Executed; Clock.Interval = 1.0f / 60.0f; Clock.Elapsed += Clock_Elapsed; }
public static void Main(string[] args) { VeldridSurface.InitializeOpenTK(); var platform = new Eto.Mac.Platform(); // FIXME: This seems to be necessary in order for Mac Release builds // to run when double-clicked from Finder. Running the executable // from a Terminal works without this. I suspect it has something to // do with the use of mkbundle, and whatever effect that has on // loading handlers exported from assemblies with Eto.ExportHandler. platform.Add <VeldridSurface.IHandler>(() => new Eto.Veldrid.Mac.MacVeldridSurfaceHandler()); // AppContext.BaseDirectory is too simple for the case of the Mac // projects. When building an app bundle that depends on the Mono // framework being installed, it properly returns the path of the // executable in Eto.Veldrid.app/Contents/MacOS. When building an // app bundle that instead bundles Mono by way of mkbundle, on the // other hand, it returns the directory containing the .app.. new Application(platform).Run(new MainForm( Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), Path.Combine("..", "Resources", "shaders"))); }