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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends

# MViewportRenderer Class Reference
OpenMayaRender - API module for rendering

This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013, 3.8 Render Loop Overrides.

Search for all occurrences

## Detailed Description

Base class for hardware viewport renderers.

MViewportRenderer is a class which represents a hardware viewport renderer.

Examples:

  D3DViewportRenderer.cpp, D3DViewportRenderer.h, OpenGLViewportRenderer.cpp, and OpenGLViewportRenderer.h.

`#include <MViewportRenderer.h>`

List of all members.

## Public Types
enum | RenderingAPI { kOpenGL, kDirect3D, kSoftware }
| API used for rendering. More...
enum | RenderingOverride { kNoOverride, kOverrideAllDrawing, kOverrideThenStandard, kOverrideThenUI }
| Override status. More...
enum | RenderingExclusion
| Rendering exclusions when RenderingOverride is kOverrideThenStandard.
## Public Member Functions
| MViewportRenderer (const MString &name)
| Constructor.
virtual | ~MViewportRenderer ()
| Destructor.
virtual MStatus | initialize ()=0
| Renderer initialization.
virtual MStatus | uninitialize ()=0
| Renderer cleanup.
virtual MStatus | render (const MRenderingInfo &info)=0
| Method which does the actual rendering.
virtual bool | nativelySupports (MViewportRenderer::RenderingAPI api, float version)=0
| Query the native rendering API's supported by this renderer.
virtual bool | override (MViewportRenderer::RenderingOverride override)=0
| Check if override exists.
virtual unsigned int | overrideThenStandardExclusion () const
| Rendering exclusion for standard pass of kOverrideThenStandard.
MStatus | registerRenderer () const
| Register the renderer.
MStatus | deregisterRenderer () const
| Deregister the renderer.
const MString & | name () const
| Return the internal name of the renderer.
const MString & | UIname () const
| Return the name of the renderer as it should appear to users.
void | setUIName (const MString &name)
| Set the name of the renderer as it should appear to users.
MViewportRenderer::RenderingOverride | renderingOverride () const
| Return the override status.
void | setRenderingOverride (RenderingOverride override)
| Set the rendering override for the renderer.
## Friends
class | MHardwareRenderer Search for all occurrences

## Member Enumeration Documentation

enum RenderingAPI

Search for all occurrences

API used for rendering.

Enumerator:

  kOpenGL | Renderer uses hardware OpenGL for rendering. Search for all occurrences
  kDirect3D | Renderer uses hardware Direct3D for rendering. Search for all occurrences
  kSoftware | Renderer renders using software. Search for all occurrences

enum RenderingOverride

Search for all occurrences

Override status.

Enumerator:

  kNoOverride | Override nothing. Search for all occurrences
  kOverrideAllDrawing | Override all drawing. Search for all occurrences
  kOverrideThenStandard | Override all drawing, then follow with a standard render pass. Search for all occurrences
  kOverrideThenUI | Override draw, then follow with a UI only render pass. Search for all occurrences

## Constructor & Destructor Documentation

MViewportRenderer | ( | const MString & | name | ) |

Constructor.

By default the user interface name is set to be the internal name. The user is free to change the UI. The internal name cannot be changed once set.

Parameters:

  [in] | name | internal name of the renderer

~MViewportRenderer | ( |  | ) | `[virtual]`

Destructor.

Class destructor.

## Member Function Documentation

MStatus initialize | ( |  | ) | `[pure virtual]`

Search for all occurrences

Renderer initialization.

This method gets called to allow the renderer to perform a one time initialization.

The corresponding method for cleanup is uninitialize().

Initialization is called if and only if the renderer has been registered. See register() method.

Returns:
  MStatus::kSuccess : if execution was successful.

Examples:
  D3DViewportRenderer.h, and OpenGLViewportRenderer.h.

MStatus uninitialize | ( |  | ) | `[pure virtual]`

Search for all occurrences

Renderer cleanup.

This method gets called to allow the renderer to perform a one time de-initialization.

The corresponding method for cleanup is initialize().

Returns:
  MStatus::kSuccess : if execution was successful.

Examples:
  D3DViewportRenderer.h, and OpenGLViewportRenderer.h.

MStatus render | ( | const MRenderingInfo & | info | ) | `[pure virtual]`

Search for all occurrences

Method which does the actual rendering.

This method gets called to allow the renderer to perform rendering.

It will be called whenever the viewport to which it is registered, requires a refresh.

Parameters:

  [in] | info |

Returns:
  MStatus::kSuccess : if execution was successful.

Examples:
  D3DViewportRenderer.h, and OpenGLViewportRenderer.h.

bool nativelySupports | ( | MViewportRenderer::RenderingAPI | api,
|  | float | version
| ) |  | `[pure virtual]`

Search for all occurrences

Query the native rendering API's supported by this renderer.

Query the renderer to see if the renderer can natively support a specific API and API version number.

This is to provide compatibility checks between the drawing API used for the render target of this renderer, and the renderer itself.

As an example the render target may be using OpenGL natively while the renderer associated with the render target is using Direct3D. In this case the method should return false.

As an example the render target may be using Direct3D version K natively while the renderer associated with the render target is using Direct3D version L. In this case the method may return false.

Parameters:

  [in] | api | rendering API natively used by the render target
  [in] | version | rendering API version of the API natively used by the render target

Returns:
  MViewportRenderer::RenderingAPI : rendering API.

Examples:
  D3DViewportRenderer.h, and OpenGLViewportRenderer.h.

bool override | ( | MViewportRenderer::RenderingOverride | override | ) | `[pure virtual]`

Search for all occurrences

Check if override exists.

This method gets called to query the renderer to see if it has a given type of render target override.

Parameters:

  [in] | override | render target override

Returns:
  true if the renderer overrides the render target override.

Examples:
  D3DViewportRenderer.h, and OpenGLViewportRenderer.h.

unsigned int overrideThenStandardExclusion | ( |  | ) | const`[virtual]`

Search for all occurrences

Rendering exclusion for standard pass of kOverrideThenStandard.

This method gets called to query the renderer to see what should be excluded from the standard pass when the RenderingOverride mode is kOverrideThenStandard.

If this method is not redefined by the derived class, it returns kExcludeAll.

Returns:
  A bitmask constructed from the RenderingExclusion enum.

MStatus registerRenderer | ( |  | ) | const

Search for all occurrences

Register the renderer.

Registration should occur when the plugin is initialized. A renderer will be available for usage from 3d modeling viewports if and only if it has been registered.

Additionally, the initialization method initialize() will be made only if a renderer has been registered.

Returns:
  MStatus::kSuccess : if execution was successful.

MStatus deregisterRenderer | ( |  | ) | const

Search for all occurrences

Deregister the renderer.

Deregistration should occur when the plugin is unloaded.

Returns:
  MStatus::kSuccess : if execution was successful.

const MString & name | ( |  | ) | const

Search for all occurrences

Return the internal name of the renderer.

Returns:
  renderer name

const MString & UIname | ( |  | ) | const

Search for all occurrences

Return the name of the renderer as it should appear to users.

Returns:
  UI renderer name

void setUIName | ( | const MString & | name | ) |

Search for all occurrences

Set the name of the renderer as it should appear to users.

Parameters:

  [in] | name | name to set

MViewportRenderer::RenderingOverride renderingOverride | ( |  | ) | const

Search for all occurrences

Return the override status.

Returns:
  Override status.

void setRenderingOverride | ( | RenderingOverride | override | ) |

Search for all occurrences

Set the rendering override for the renderer.

Parameters:

  [in] | override | override value to set

MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer
MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer MViewportRenderer