C++ API Reference
MRenderTarget Class Reference

An instance of a render target that may be used with Viewport 2.0. More...

#include <MRenderTargetManager.h>

Public Member Functions

MStatus updateDescription (const MRenderTargetDescription &targetDescription)
 Change the description of a render target. More...
 
void targetDescription (MRenderTargetDescription &desc) const
 Get target description. More...
 
void * resourceHandle () const
 This method allows access to the draw API dependent handle for a render target. More...
 
void * rawData (int &rowPitch, size_t &slicePitch)
 Get a copy of the raw data mapped to the target. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
static void freeRawData (void *data)
 Convenience method that simply deletes the data that is allocated in the MRenderTarget::rawData() method. More...
 

Detailed Description

Member Function Documentation

MStatus updateDescription ( const MRenderTargetDescription targetDescription)

Change the description of a render target.

This will mean a reallocation of the targets internal representation.

A common situation requiring this method to be called is to resize a render target.

Parameters
[in]targetDescriptionDescription to update the target to.
Returns
Status code
Status Codes:
Examples:
viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, viewRenderOverride/viewRenderOverride.cpp, and viewRenderOverrideMRT/viewRenderOverrideMRT.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.
void * resourceHandle ( ) const

This method allows access to the draw API dependent handle for a render target.

This handle is owned by the MRendertarget and is provided to allow access to use a target as a read-only object.

Modifications should never be performed on this target handle.

Any modifications may result in unpredictable stability as the MRenderTarget no longer has knowledge of the target contents.

For OpenGL, a pointer to an OpenGL texture identifier is returned.

For DirectX 10 and higher, a reference to a Direct3D "view" of a target is returned. If the render target is a color target then a "render target view" will be returned. If it is a depth-stencil target then a "depth stencil view" will be returned.

Returns
A pointer (handle) to the target if successful, otherwise NULL.
Examples:
dx11Shader/dx11Shader.cpp, hwApiTextureTest/hwRendererHelperDX.cpp, and hwApiTextureTest/hwRendererHelperGL.cpp.
void * rawData ( int &  rowPitch,
size_t &  slicePitch 
)

Get a copy of the raw data mapped to the target.

The caller must deallocate the system memory as the target itself does not keep any references to it. The convenience method MTexture::freeRawData() can be used to deallocate memory.

Parameters
[out]rowPitchThe row pitch of the data. It represents the number of bytes of one line of the target data.
[out]slicePitchThe slice pitch of the data. It represents the number of bytes of the whole target data.
Returns
A pointer to the data, or NULL on failure
Examples:
dx11Shader/dx11Shader.cpp, and hwApiTextureTest/hwRendererHelper.cpp.
void freeRawData ( void *  data)
static

Convenience method that simply deletes the data that is allocated in the MRenderTarget::rawData() method.

This method can be used to safely free data within a plug-in which is compiled in debug mode.

Parameters
[in]dataRaw data. After deletion the pointer no longer points to a valid memory location.

The documentation for this class was generated from the following files: