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.
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() { ... } ...