Graphics Reference
In-Depth Information
Using a 16-bit depth buffer can result in undesirable artifacts known as
z-fighting or flimmering. A 24- or 32-bit buffer performs much better.
However, it isn't possible to completely eliminate artifacts without the
use of additional algorithms. Moving the near z-plane as far from the
camera as possible can help against depth fighting artefacts. It is then
possible to use the 16-bit depth buffer more effectively.
8.
Lastly, an example of the CreateSizeDependentResources method within
a descending class to override the RS viewport might look something like the
following code snippet:
protected override void CreateSizeDependentResources(
D3DApplicationBase app)
{
// Call base implementation
base.CreateSizeDependentResources(app);
// Retrieve device immediate context
var context = this.DeviceManager.Direct3DContext;
// Create a viewport descriptor of the render size.
this.Viewport = new SharpDX.ViewportF(
(float)RenderTargetBounds.X + 100,
(float)RenderTargetBounds.Y + 100,
(float)RenderTargetBounds.Width - 200,
(float)RenderTargetBounds.Height - 200,
0.0f, // min depth
1.0f); // max depth
// Set the current viewport for the rasterizer.
context.Rasterizer.SetViewport(Viewport);
}
How it works…
Before trying to create/resize a swap chain, we first make sure that any existing views that
access swap chain resources are released. This is necessary to allow the call to SwapChain.
ResizeBuffers to work, and it is a good practice when reinitializing to ensure resources are
released in a timely manner.
 
Search WWH ::




Custom Search