Graphics Reference
In-Depth Information
By removing Windows 8.1 specific calls (such as the
SharpDX.
DXGI.Device3.Trim
method), it is also possible to implement
this recipe using Direct3D 11.1 for Windows Store apps that
target Windows 8.
See also
F
The
Rendering to a CoreWindow
and
Rendering to a SwapChainPanel
recipes show
how to create swap chains for non-XAML and XAML apps respectively
F
NuGet Package Manager can be downloaded from
http://visualstudiogallery.
msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
F
You can find the flip presentation model on MSDN at
http://msdn.microsoft.
com/en-us/library/windows/desktop/hh706346(v=vs.85).aspx
Rendering to a CoreWindow
The XAML view provider found in the Windows Store app graphics framework cannot be
modified. Therefore, when we want to implement the application's graphics completely
within DirectX/Direct3D without XAML interoperation, it is necessary to create a basic view
provider that allows us to connect our DirectX graphics device resources to the windowing
infrastructure of our Windows Store app.
In this recipe, we will implement a
CoreWindow
swap-chain target and look at how to hook
Direct3D directly to the windowing infrastructure of a Windows Store app, which is exposed by
the
CoreApplication
,
IFrameworkViewSource
,
IFrameworkView
, and
CoreWindow
.NET types.
This recipe continues from where we left off with the
Preparing the swap chain for Windows
Store apps
recipe.
How to do it…
We will first update the
Common.WinRT
project to support the creation of a swap chain
for a Windows Store app's
CoreWindow
instance and then implement a simple
Hello
World
application.
1.
Let's begin by creating a new abstract class within the Common.WinRT project, called
D3DAppCoreWindowTarget
and descending from the
D3DApplicationWinRT
class from our previous recipe. The default constructor accepts the
CoreWindow
instance and attaches a handler to its
SizeChanged
event.
using Windows.UI.Core;
using SharpDX;