#include <MGLFunctionTable.h>
This method is obsolete.
The best cross platform alternative for drawing in Viewport 2.0 is via MHWRender::MVertexBuffer, MHWRender::MPxGeometryOverride, and other classes providing an abstraction from the underlying hardware API. The MHWRender::MUIDrawManager offers handy options for very simple drawing commands.
Drawing in raw OpenGL mode will still be allowed, but we recommend you use the core profile subset of the OpenGL API to ensure compatibility with future versions of Maya.
MGLFunctionTable is a utility class which provides wrappers for the basic functions in the OpenGL API.
Core functions up to OpenGL 2.0 are provided here, as well as a number of ARB/EXT and vendor specific extensions. Refer to the MGLExtension enumeration for extensions which are checked.
Please refer to an OpenGL reference for usage of the OpenGL functions provided in this wrapper class.
When using the functions provided, the standard GL* type and constant definitions to be used can be found in MGLDefinitions.h.
MGLDefinitions.h basically provides a wrapper for what would normally be found in gl.h and glext.h files.
The naming convention used in this file is to take the regular GL* definitions and add a "M" prefix. This is to avoid conflicts with existing type and constant declarations which may be found in files such as gl.h and glext.h. It is recommended that externally provided files which have GL definitions not be included in the same C++ file to avoid conflicts. Mixing GL code wusing MGLFunctionTable and external code is possible, just not recommended.
MGLFunctionTable cannot be created on its own, and must be retrieved via a method on the MHardwareRenderer class. It is possible that this class will not be available, if the hardware renderer class cannot be instantiated. This would be due to insufficient graphics hardware support.
Below is an example of initializing and using the function table to draw a simple 3-line axis. Note the usage of the definitions from MGLDefinitions such as MGL_LIGHTING versus GL_LIGHTING, and MGL_LINES and MGL_DEPTH_TEST.
Here is a similar example of using the function table in Python.
Public Types | |
enum | MGLversion { kMGL_Version11, kMGL_Version12, kMGL_Version121, kMGL_Version13, kMGL_Version14, kMGL_Version15, kMGL_Version20 } |
OpenGL versions checked. More... | |
Public Member Functions | |
bool | extensionExists (MGLExtension extension) |
Provides information as to whether a given OpenGL extension exists. More... | |
unsigned int | numTexUnits () const |
Get information about the maximum number of texture units. More... | |
unsigned int | numTexInterpolants () const |
Get information about the maximum number of texture interpolants. More... | |
unsigned int | numTexImageUnits () const |
Get information about the maximum number of texture image units available. More... | |
unsigned int | maxTextureSize () const |
Get information about the maximum texture size. More... | |
unsigned int | maxVertexAttributes () const |
Get information about the maximum number of vertex attributes available. More... | |
Friends | |
class | MHardwareRenderer |
enum MGLversion |
bool extensionExists | ( | MGLExtension | extension | ) |
Provides information as to whether a given OpenGL extension exists.
That is, the extension is reported to be supported.
[in] | extension | Extension enumeration. |
unsigned int numTexUnits | ( | ) | const |
Get information about the maximum number of texture units.
This may not be the same as the number of interpolants available.
unsigned int numTexInterpolants | ( | ) | const |
Get information about the maximum number of texture interpolants.
unsigned int numTexImageUnits | ( | ) | const |
Get information about the maximum number of texture image units available.
unsigned int maxTextureSize | ( | ) | const |
Get information about the maximum texture size.
unsigned int maxVertexAttributes | ( | ) | const |
Get information about the maximum number of vertex attributes available.