Graphics Reference
In-Depth Information
var worldViewProjection = worldMatrix * viewProjection;
// HLSL defaults to "column-major" order matrices so
// transpose first (SharpDX uses row-major matrices).
worldViewProjection.Transpose();
// Write the worldViewProjection to the constant buffer
context.UpdateSubresource(ref worldViewProjection,
worldViewProjectionBuffer);
15. We can now call each of our renderer's Render method and present the final result.
// Render the primitives
axisLines.Render();
triangle.Render();
quad.Render();
// Render FPS
fps.Render();
// Render instructions + position changes
textRenderer.Render();
// Present the frame
Present();
16. This completes our D3DApp class. Open Program.cs , and replace the Main()
method with the following code so that we are now utilizing our D3DApp class:
static void Main()
{
#if DEBUG
// Enable object tracking
SharpDX.Configuration.EnableObjectTracking = true;
#endif
// Create the form to render to
var form = new Form1();
form.Text = "D3DRendering - Primitives";
form.ClientSize = new System.Drawing.Size(1024, 768);
form.Show();
// Create and initialize the new D3D application
// Then run the application.
using (D3DApp app = new D3DApp(form))
{
// Only render frames at the maximum rate the
// display device can handle.
app.VSync = true;
 
Search WWH ::




Custom Search