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

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions

# MHwTextureManager Class Reference
OpenMayaRender - API module for rendering

Search for all occurrences

## Detailed Description

Hardware Texture management.

The MHwTextureManager provides an interface for loading and using hardware textures.

`#include <MHwTextureManager.h>`

List of all members.

## Static Public Member Functions
static MStatus | glBind (const MObject &fileTextureObject, MImageFileInfo::MHwTextureType &targetType, MImageFileInfo::MImageType imageType=MImageFileInfo::kImageTypeUnknown)
| Bind the contents of a file texture node to the currently active OpenGL texture unit.
static MStatus | glBind (const MPlug &fileTextureConnection, MImageFileInfo::MHwTextureType &targetType, MImageFileInfo::MImageType imageType=MImageFileInfo::kImageTypeUnknown)
| Bind the contents of a specific file texture node attribute (e.g.
static MStatus | registerTextureFile (const MString &fileName, MHwTextureFileHandle &hTexture)
| Register a named texture file.
static MStatus | deregisterTextureFile (const MHwTextureFileHandle &hTexture)
| Deregisters the given handle to a texture entry in the manager.
static MStatus | textureFile (const MHwTextureFileHandle &hTexture, MString &fileName)
| Return the file name associated with a given texture file handle.
static MStatus | glBind (const MHwTextureFileHandle &hTexture, MImageFileInfo::MHwTextureType &targetType, MImageFileInfo::MImageType imageType=MImageFileInfo::kImageTypeUnknown)
| Bind the contents of a specific file to the currently active OpenGL texture unit.
static const char * | className ()
| Returns the name of this class.

## Member Function Documentation

MStatus glBind | ( | const MObject & | fileTextureObject,
|  | MImageFileInfo::MHwTextureType & | targetType,
|  | MImageFileInfo::MImageType | imageType = `MImageFileInfo::kImageTypeUnknown`
| ) |  | `[static]`

Search for all occurrences

Bind the contents of a file texture node to the currently active OpenGL texture unit.

Parameters:

  [in] | fileTextureObject | the file texture node to bind
  [in,out] | targetType | the target type of the texture (e.g. 2D, cube map, etc). If the initial value of this argument is anything other than kHwTextureUnknown, this parameter acts as an input to specify the type you require, and the call will fail if the texture can not be bound to this type. If the initial value of this argument is kHwTextureUnknown, this parameter acts as a return value to let you know what type of texture has been bound.
  [in] | imageType | the type of information you are expecting in the texture (e.g. color, normal, etc). If specified, this argument may be used to tune mipmap generation.

Returns:
  - MS::kFailure if the texture cannot be bound, or is incompatible with the specified parameters
  - MS::kSuccess otherwise

Examples:
  cgfxShaderNode.cpp, hlslShader.cpp, hwManagedTextureShader.cpp, and OpenGLViewportRenderer.cpp.

MStatus glBind | ( | const MPlug & | fileTextureConnection,
|  | MImageFileInfo::MHwTextureType & | targetType,
|  | MImageFileInfo::MImageType | imageType = `MImageFileInfo::kImageTypeUnknown`
| ) |  | `[static]`

Search for all occurrences

Bind the contents of a specific file texture node attribute (e.g.

color, alpha) to the currently active OpenGL texture unit. As part of this operation, the texture target will also be enabled (i.e. there is no need to call glEnable( targetType) before or after calling this method).

Parameters:

  [in] | fileTextureConnection | the file texture node to bind
  [in,out] | targetType | the target type of the texture (e.g. 2D, cube map, etc). If the initial value of this argument is anything other than kHwTextureUnknown, this parameter acts as an input to specify the type you require, and the call will fail if the texture can not be bound to this type. If the initial value of this argument is kHwTextureUnknown, this parameter acts as a return value to let you know what type of texture has been bound.
  [in] | imageType | the type of information you are expecting in the texture (e.g. color, normal, etc). If specified, this argument may be used to tune mipmap generation.

Returns:
  - MS::kFailure if the texture cannot be bound, or is incompatible with the specified parameters
  - MS::kSuccess otherwise

MStatus registerTextureFile | ( | const MString & | fileName,
|  | MHwTextureFileHandle & | hTexture
| ) |  | `[static]`

Search for all occurrences

Register a named texture file.

Returns a handle to a texture entry in the texture manager. The caller is responsible for calling the associated deregisterTextureFile to avoid leaking memory.

Parameters:

  [in] | fileName | the texture file to register
  [out] | hTexture | the output handle to a texture entry representing the given file.

Returns:
  - MS::kFailure if the fileName was invalid.
  - MS::kSuccess otherwise.

MStatus deregisterTextureFile | ( | const MHwTextureFileHandle & | hTexture | ) | `[static]`

Search for all occurrences

Deregisters the given handle to a texture entry in the manager.

If there are no other handles to this texture entry, the texture resource will be freed.

This method assumes that a context is already set. Failing to have a valid current context when invoking this method will cause a memory leak.

Parameters:

  [in] | hTexture | the texture handle to release

Status Codes:
  - MS::kFailure if the texture handle was invalid.
  - MS::kSuccess otherwise

MStatus textureFile | ( | const MHwTextureFileHandle & | hTexture,
|  | MString & | fileName
| ) |  | `[static]`

Search for all occurrences

Return the file name associated with a given texture file handle.

Parameters:

  [in] | hTexture | the texture handle to query
  [in] | fileName | the output file name

Returns:
  - MS::kFailure if the texture handle was invalid.
  - MS::kSuccess otherwise

MStatus glBind | ( | const MHwTextureFileHandle & | hTexture,
|  | MImageFileInfo::MHwTextureType & | targetType,
|  | MImageFileInfo::MImageType | imageType = `MImageFileInfo::kImageTypeUnknown`
| ) |  | `[static]`

Search for all occurrences

Bind the contents of a specific file to the currently active OpenGL texture unit.

As part of this operation, the texture target will also be enabled (i.e. there is no need to call glEnable( targetType) before or after calling this method).

Parameters:

  [in] | hTexture | the texture file handle to load
  [in,out] | targetType | the target type of the texture (e.g. 2D, cube map, etc). If the initial value of this argument is anything other than kHwTextureUnknown, this parameter acts as an input to specify the type you require, and the call will fail if the texture can not be bound to this type. If the initial value of this argument is kHwTextureUnknown, this parameter acts as a return value to let you know what type of texture has been bound.
  [in] | imageType | the type of information you are expecting in the texture (e.g. color, normal, etc). If specified, this argument may be used to tune mipmap generation.

Returns:
  - MS::kFailure if the texture cannot be bound, or is incompatible with the specified parameters
  - MS::kSuccess otherwise

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager
MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager MHwTextureManager