Graphics Reference
In-Depth Information
See also
F
The following recipes
Creating the device-dependent resources
,
Creating the
size-dependent resources
, and
Creating a Direct3D renderer class
explore the
sample rendering framework further, before we implement a full example within
Rendering primitives
F
Chapter 11
,
Integrating Direct3D with XAML and Windows 8.1
includes the changes
to the rendering framework that are necessary to work with the Windows Store apps
Creating device-dependent resources
In this recipe, we will see how the included sample framework deals with the initialization
of device-dependent Direct3D resources and how our custom classes can make use of this
throughout this topic.
Getting ready
We continue from where we left off in the
Using the sample rendering framework
recipe.
How to do it…
We will review the base class's implementation of the
CreateDeviceDependentResources
function, and then look at how to implement overrides within the descending classes.
1.
The following protected virtual
D3DApplicationBase.
CreateDeviceDependentResources
implementation is assigned
as an event-handler to the
DeviceManager.OnInitialize
event.
protected
virtual
void CreateDeviceDependentResources(DeviceManag
er deviceManager)
{
if (_swapChain != null)
{
// Release the swap chain
RemoveAndDispose(ref _swapChain);
// Force reinitialize size dependent resources
SizeChanged(true);
}
}