Graphics Reference
In-Depth Information
// Render frame
d3dApp.Render();
}
}
8.
The D3DApp class follows the same structure from our previous recipes throughout
the topic. There are only a few minor differences as highlighted in the following
code snippet:
class D3DApp: Common.D3DAppCoreWindowTarget
{
public D3DApp(Windows.UI.Core.CoreWindow window)
: base(window)
{ this.VSync=true; }
// Private member fields
...
protected override void CreateDeviceDependentResources(
Common.DeviceManager deviceManager)
{
... create all device resources
... and create renderer instances here
}
// Render frame
public override void Render()
{
var context = this.DeviceManager.Direct3DContext;
// OutputMerger targets must be set every frame
context.OutputMerger.SetTargets(
this.DepthStencilView, this.RenderTargetView);
// Clear depthstencil and render target
context.ClearDepthStencilView(
this.DepthStencilView,
SharpDX.Direct3D11.DepthStencilClearFlags.Depth |
SharpDX.Direct3D11.DepthStencilClearFlags.Stencil
, 1.0f, 0);
context.ClearRenderTargetView(
this.RenderTargetView, SharpDX.Color.LightBlue);
... setup context pipeline state
... perform rendering commands
// Present the render target
Present();
}
}
 
Search WWH ::




Custom Search