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 a Direct3D renderer class


In this recipe, we will look at the final component of our sample rendering framework, the renderer. These are classes that implement specific rendering logic, such as drawing a mesh or utility classes that wish to participate within the Direct3D resource lifecycle management of the rendering framework.

Getting ready

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

How to do it…

We will first look at the steps necessary to create a Common.RendererBase descendent and then how this class would be created, initialized, and finally execute its Direct3D draw commands.

  1. Creating a renderer class within the sample framework requires the following minimal code:

    public class MyRenderer : Common.RendererBase
    {
       // Create device dependent resources
       protected override void CreateDeviceDependentResources()
       { ... }
    
       // Create size dependent resources
       protected override void CreateSizeDependentResources()
       { ... }
    
      ...