Book Image

Direct3D Rendering Cookbook

Book Image

Direct3D Rendering Cookbook

Overview of this book

Table of Contents (19 chapters)
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Further Reading
Index

Creating size-dependent resources


In this recipe, we will look at how the included sample framework deals with the initialization of size-dependent Direct3D resources within the base Direct3D application class. We review the base class's implementation, and then implement an override for a descending class.

We also review two important graphics pipeline preparation steps that are dependent upon the render target size: creating the viewport for the Rasterizer Stage (RS) and creating a depth/stencil buffer and view for the Output Merger (OM) stage.

Getting ready

We continue on from where we left off in the Using the sample rendering framework recipe.

How to do it…

The application base class D3DApplicationBase initializes the swap chain buffers and render targets within the CreateSizeDependentResources method, which is an event-handler attached to the D3DApplicationBase.OnSizeChanged event. This method has been implemented as follows:

  1. The base implementation is a protected virtual method that allows...