3.2 The Renderer

 
 
 

The API interface to the render framework is exposed in the API class MRenderer.

The class itself, for the most part, is an interface which allows access to rendering resources as well as the interface for registering render loop overrides. The various resource managers available from here include:

NoteThe state manager is not accessible from MRenderer as state only accessible from within the draw phase of the pipeline (when a draw context is available)

The actual GPU device as well as information about the GPU draw API (DirectX11 or OpenGL) are also accessible from this class. The GPU device is the DX device for DirectX11, while for OpenGL, this is the main OpenGL context used by the rendering framework. For OpenGL, this context differs depending on whether Maya is running in interactive or batch modes. There is no guarantee that the context is the same as the one used to draw into the interactive viewports.

For any given instance of Maya, only one device for a given draw API is active. As such, though it is possible for a plug-in to use both DirectX and OpenGL at the same time, the rendering framework only provides support for one or the other.

Figure 33: At the core is a GPU device initiated to run a specific draw API. Various GPU handles specific to that draw API can be accessed via the constructs exposed by the API managers or renderer. The renderer, and texture, shader and target managers are accessible anytime in the pipeline. Overrides are active only during certain times in the pipeline. Within this time, a draw context can be accessed. When this context is accessed the state manager is available.

All interfaces have a common namespace MHWRender and currently the interfaces only have C++ language bindings.