public Program() { _app = new GrasshopperApp().UseSharpDX(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _vertexBufferManager = _graphics.VertexBufferManagerFactory.Create <Vertex>(); _renderTarget.Window.Title = "Dynamic Texture"; _renderTarget.Window.Visible = true; }
public Program() { _app = new GrasshopperApp().UseSharpDX(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _vertexBufferManager = _graphics.VertexBufferManagerFactory.Create<Vertex>(); _renderTarget.Window.Title = "Simple Quad"; _renderTarget.Window.Visible = true; }
public Program() { _app = new GrasshopperApp().UseSharpDX(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create<Matrix4x4>(); _meshBufferManager = new MeshBufferManager<Vertex>(_graphics); _renderTarget.Window.Title = "Simple Cube"; _renderTarget.Window.Visible = true; }
public Program() { _app = new GrasshopperApp().UseSharpDX(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create <Matrix4x4>(); _meshBufferManager = new MeshBufferManager <Vertex>(_graphics); _renderTarget.Window.Title = "Simple Cube"; _renderTarget.Window.Visible = true; }
public Program() { _app = new GrasshopperApp().UseSharpDX(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create <SceneData>(); _meshBufferManager = new MeshBufferManager <Vertex>(_graphics); _instanceBufferManager = _graphics.VertexBufferManagerFactory.Create <CubeInstance>(); _renderTarget.Window.Title = "Many Cubes"; _renderTarget.Window.Visible = true; }
static void Main(string[] args) { using (var app = new GrasshopperApp().UseSharpDX()) using (var gfx = app.Graphics.CreateContext(enableDebugMode: true)) // In this sample we'll create two windows and display each of them with different colours and // titles displaying different information using (var main = gfx.RenderTargetFactory.CreateWindow()) using (var other = gfx.RenderTargetFactory.CreateWindow()) { main.Window.Visible = true; other.Window.Visible = true; // Our main loop runs as fast as possible, but we only want to render at 60fps var fpsLimiter = new RateLimiter(60); app.Run(frame => { if (!fpsLimiter.Ready()) { return(true); } // The first window will show our true frame rate which should be over a million cycles // per second (of which only 60 per second will include the redraws below) main.Render(context => { context.Window.Title = "Hello, window #1! Current ticks per second: " + frame.FramesPerSecond.ToString("0"); context.Clear(Color.CornflowerBlue); context.Present(); }); // The second window will show the current time other.Render(context => { context.Window.Title = "Hello, window #2! It's currently " + DateTime.UtcNow.ToString("F"); context.Clear(Color.Tomato); context.Present(); }); // Closing a window sends an exit request, which we can treat as we see fit. In this // case, we will terminate the application by returning false from the main loop only // when both windows are closed. return(!(main.Terminated && other.Terminated)); }); } }
static void Main(string[] args) { using(var app = new GrasshopperApp().UseSharpDX()) using(var gfx = app.Graphics.CreateContext(enableDebugMode: true)) // In this sample we'll create two windows and display each of them with different colours and // titles displaying different information using(var main = gfx.RenderTargetFactory.CreateWindow()) using(var other = gfx.RenderTargetFactory.CreateWindow()) { main.Window.Visible = true; other.Window.Visible = true; // Our main loop runs as fast as possible, but we only want to render at 60fps var fpsLimiter = new RateLimiter(60); app.Run(() => { if(!fpsLimiter.Ready()) return true; // The first window will show our true frame rate which should be over a million cycles // per second (of which only 60 per second will include the redraws below) main.Render(context => { context.Window.Title = "Hello, window #1! Current ticks per second: " + app.TickCounter.TicksPerSecond.ToString("0"); context.Clear(Color.CornflowerBlue); context.Present(); }); // The second window will show the current time other.Render(context => { context.Window.Title = "Hello, window #2! It's currently " + DateTime.UtcNow.ToString("F"); context.Clear(Color.Tomato); context.Present(); }); // Closing a window sends an exit request, which we can treat as we see fit. In this // case, we will terminate the application by returning false from the main loop only // when both windows are closed. return !(main.Terminated && other.Terminated); }); } }
public Program() { _app = new GrasshopperApp() .UseSharpDX() .UseWindowsFileSystem(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create <SceneData>(); _meshBufferManager = new MeshBufferManager <Vertex>(_graphics); _instanceBufferManager = _graphics.VertexBufferManagerFactory.Create <CubeInstance>(); _renderTarget.Window.Title = "Flying Through Cubes"; _renderTarget.Window.Visible = true; _renderTarget.Window.SetFullScreen(); _renderTarget.Window.SizeChanged += UpdateAspectRatio; UpdateAspectRatio(_renderTarget.Window); }
public Program() { _app = new GrasshopperApp() .UseSharpDX() .UseWindowsFileSystem(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create<SceneData>(); _meshBufferManager = new MeshBufferManager<Vertex>(_graphics); _instanceBufferManager = _graphics.VertexBufferManagerFactory.Create<CubeInstance>(); _renderTarget.Window.Title = "Flying Through Cubes"; _renderTarget.Window.Visible = true; _renderTarget.Window.SetFullScreen(); _renderTarget.Window.SizeChanged += UpdateAspectRatio; UpdateAspectRatio(_renderTarget.Window); }
public Program() { _app = new GrasshopperApp() .UseSharpDX() .UseWindowsFileSystem(); _graphics = _app.Graphics.CreateContext(enableDebugMode: true); _renderTarget = _graphics.RenderTargetFactory.CreateWindow(); _constantBufferManager = _graphics.ConstantBufferManagerFactory.Create<SceneData>(); _meshBufferManager = new MeshBufferManager<Vertex>(_graphics); _instanceBufferManager = _graphics.VertexBufferManagerFactory.Create<CubeInstance>(); _renderTarget.Window.Title = "Many Textured Cubes"; _renderTarget.Window.Visible = true; }
public FrameContext(GrasshopperApp app) { App = app; NextFrame(); }