Graphics Reference
In-Depth Information
3.
Finally, within a render loop, we can tell the renderer instance to perform its draw
commands as shown in the following line of code:
myRenderer.Render();
How it works…
The
Common.RendererBase
abstract class is similar to the
D3DApplicationBase
class.
It follows the same approach for managing the lifecycle of Direct3D resources by using
the
SharpDX.Component
class and the
CreateDeviceDependentResources
and
CreateSizeDependentResources
methods. In addition, a public
Render
method is
available for executing the renderer's Direct3D commands.
The following class diagram shows the available methods and properties:
Sample rendering framework renderer class diagram
Implementations of the
RendererBase
class included in the rendering framework sample
code includes the
TextRenderer
and the
FpsRenderer
classes. The text renderer uses the
Direct2D device and context to render text of the specified font, size, and color at the desired
screen location. The FPS renderer descends from the text renderer and displays the current
frame rate and frame time (100 frames simple moving average).
See also
F
The recipes in
Chapter 9
,
Rendering on Multiple Threads and Deferred Contexts
,
demonstrate how to control the current device context for a renderer instance