- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MRenderer Class Reference
OpenMayaRender - API module for rendering

This reference page is linked to from the following overview topics: フレームワーク クラス(Framework Classes), Devkit サンプル.

Search for all occurrences

## Detailed Description

Main interface class to the Viewport 2.0 renderer.

Examples:

  hwPhongShader.cpp.

`#include <MViewport2Renderer.h>`

List of all members.

## Public Member Functions
MHWRender::DrawAPI | drawAPI () const
| Returns the current drawing API.
bool | drawAPIIsOpenGL () const
| Method will indicate whether the current drawing API is OpenGL or not.
unsigned int | drawAPIVersion () const
| Method will return the version of drawing API.
void * | GPUDeviceHandle () const
| Method will return a pointer to the GPU "device".
const MShaderManager * | getShaderManager () const
| Access the shader manager.
const MRenderTargetManager * | getRenderTargetManager () const
| Access the render target manager.
MTextureManager * | getTextureManager () const
| Access the texture manager.
MStatus | registerOverride (const MRenderOverride *roverride)
| Register the override as being usable by the renderer.
MStatus | deregisterOverride (const MRenderOverride *roverride)
| Deregister an existing render override on the renderer.
const MRenderOverride * | findRenderOverride (const MString &name)
| Return a reference to an existing render override registered with the renderer.
const MString | activeRenderOverride () const
| Get the name of the active override.
unsigned int | renderOverrideCount ()
| Get the number of registered render overrides.
MStatus | setRenderOverrideName (const MString &name)
| Set the name of a render override (MHWRender::MRenderOverride) for batch rendering.
MString | renderOverrideName (MStatus *ReturnStatus=NULL) const
| Get the current render override name used for batch rendering.
## Static Public Member Functions
static void | setGeometryDrawDirty (MObject obj, bool topologyChanged=true)
| Notify the Viewport 2.0 renderer that something about obj has changed, causing the object to be updated in the viewport.

## Member Function Documentation

MHWRender::DrawAPI drawAPI | ( |  | ) | const

Search for all occurrences

Returns the current drawing API.

Returns 'kNone' if the renderer is not initialized.

Returns:
  The current drawing API

bool drawAPIIsOpenGL | ( |  | ) | const

Search for all occurrences

Method will indicate whether the current drawing API is OpenGL or not.

Returns:
  True if the API is OpenGL.

unsigned int drawAPIVersion | ( |  | ) | const

Search for all occurrences

Method will return the version of drawing API.

Returns:
  Draw API version, or 0 if the renderer is not initialized properly.

void * GPUDeviceHandle | ( |  | ) | const

Search for all occurrences

Method will return a pointer to the GPU "device".

In the case that the drawing API is OpenGL then the "device" is a handle to an OpenGL context.

It is imperative that when a programmer makes any modifications to the device or context that the pre-modified state always be restored after the changes are no longer required. If this is not done then Maya's internal state tracking system will become inconsistent. This can result in unpredictable rendering behaviour.

Returns:
  A void pointer to the device or context. The pointer must be cast to the correct data type depending on the draw API. For example a cast to an HGLRC would be required to get an OpenGL context on Windows platforms.

If the renderer has not been initialized a NULL pointer will be returned.

const MShaderManager * getShaderManager | ( |  | ) | const

Search for all occurrences

Access the shader manager.

The shader manager can be used to produce MShaderInstance objects which may be assigned to MRenderItem objects by implementations of MPxGeometryOverride.

Returns:
  A pointer to the shader manager of NULL if the renderer is not initialized properly.

const MRenderTargetManager * getRenderTargetManager | ( |  | ) | const

Search for all occurrences

Access the render target manager.

The render target manager can be used to produce MRenderTarget objects which may be assigned to MRenderOperation objects as output target overrides.

Returns:
  A pointer to the manager of NULL if the renderer is not initialized properly.

MTextureManager * getTextureManager | ( |  | ) | const

Search for all occurrences

Access the texture manager.

The texture manager can be used to acquire texture

Returns:
  A pointer to the texture manager of NULL if the renderer is not initialized properly.

Examples:
  hwPhongShader.cpp.

MStatus registerOverride | ( | const MRenderOverride * | roverride | ) |

Search for all occurrences

Register the override as being usable by the renderer.

If the override is already registered it will not be registered again.

Parameters:

  [in] | roverride | Rendering override to be registered.

Returns:
  Status code

Status Codes:
  - MS::kSuccess Override was registered.
  - MS::kFailure Override failed to register.

MStatus deregisterOverride | ( | const MRenderOverride * | roverride | ) |

Search for all occurrences

Deregister an existing render override on the renderer.

The renderer will remove this override from it's list of registered overrides.

Parameters:

  [in] | roverride | Rendering override to be deregistered.

Returns:
  Status code

Status Codes:
  - MS::kSuccess Override was deregistered
  - MS::kFailure Override failed to be deregistered.

const MRenderOverride * findRenderOverride | ( | const MString & | name | ) |

Search for all occurrences

Return a reference to an existing render override registered with the renderer.

Parameters:

  [in] | name | Name of override to find

Returns:
  Status code

Status Codes:
  - MS::kSuccess Override was found.
  - MS::kFailure Override was not found.

const MString activeRenderOverride | ( |  | ) | const

Search for all occurrences

Get the name of the active override.

There can only be on active override at any given time and that override must exist be registered with the renderer.

Returns:
  Name of active override. If none an empty string will be returned.

unsigned int renderOverrideCount | ( |  | ) |

Search for all occurrences

Get the number of registered render overrides.

Returns:
  Number of registered overrides

MStatus setRenderOverrideName | ( | const MString & | name | ) |

Search for all occurrences

Set the name of a render override (MHWRender::MRenderOverride) for batch rendering.

Parameters:

  [in] | name | Name of the override.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The override was set.
  - MS::kFailure The override could not be set.

MString renderOverrideName | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Get the current render override name used for batch rendering.

If there is no override then an empty string will be returned

Parameters:

  [out] | ReturnStatus | return status.

Returns:
  Override name.

void setGeometryDrawDirty | ( | MObject | obj,
|  | bool | topologyChanged = `true`
| ) |  | `[static]`

Search for all occurrences

Notify the Viewport 2.0 renderer that something about obj has changed, causing the object to be updated in the viewport.

Note that this method does NOT perform any DG evaluation when it is called. This method is an extention of the dirty propagation system. It adds obj to the list of objects which must be updated before the next frame is rendered. The actual evaluation does not occur until the next viewport refresh.

Parameters:

  [in] | obj | DAG object which has been modified.
  [in] | topologyChanged | has the object topology changed

Examples:
  apiMeshShape.cpp.

MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer
MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer