class MPxGlBuffer

Jump to documentation

Base class for user defined GL buffers (OpenMayaUI)

public members:

MPxGlBuffer ()
MPxGlBuffer ( M3dView &view )
virtual ~MPxGlBuffer ()
virtual MStatus open ( short width, short height, GLXContext shareCtx = NULL )
virtual GLXDrawable drawable ( MStatus * ReturnStatus = NULL )
virtual GLXContext context ( MStatus * ReturnStatus = NULL )
virtual Display * display ( MStatus * ReturnStatus = NULL )
virtual XVisualInfo * visual ( MStatus * ReturnStatus = NULL )
virtual int * attributeList ( MStatus * ReturnStatus = NULL )
virtual MStatus setUseExternalDrawable ( bool state )
virtual MStatus setDoubleBuffer ( bool state )
virtual MStatus setDisplay ( Display * disp )
virtual MStatus setDrawable ( GLXDrawable drawable )
virtual MStatus setVisual ( XVisualInfo * vis )
virtual MStatus close ()

protected members:

bool hasColorIndex
bool hasAlphaBuffer
bool hasDepthBuffer
bool hasAccumulationBuffer
bool hasDoubleBuffer
bool hasStencilBuffer

Documentation

Create user defined (off-screen) GL buffers.
Description

This is the base class for user defined GL buffers, however; it is seldom necessary to derive from this class. It is generally suficient to directly use it. In cases where creating a child class is desirable, it will only work if every overridden method calls the parent method at some point in its execution.

There are two basic ways to use this class, to draw to a pbuffer and to draw to an external window:

To draw to a pbuffer:

  1. set setDoubleBuffer() to true if a double buffered pbuffer is desired.
  2. use open() to create the pbuffer
  3. use M3dView:refresh() to have Maya draw to the pbuffer.
  4. (optionally) use attributeList(), visual(), display(), drawable() and context() to find out information about the configuration of the pbuffer or to do additional drawing to it.
  5. use close() to destroy the pbuffer

To draw to an externally defined window:

  1. set setDoubleBuffer() to true if a double buffered drawable will be used.
  2. set setUseExternalDrawable() to true
  3. (optionally) use attributeList() to get the appropriate attribute list, use the resulting list to choose a visual and call setVisual() to tell Maya about that visual.
  4. (optionally) use setDisplay() to tell Maya what display to use when creating the context
  5. create a drawable X window
  6. call setDrawable() to tell Maya about the drawable.
  7. call open() to create the context
  8. use M3dView:refresh() to have Maya draw to the window
  9. (optionally) use attributeList(), visual(), display(), drawable() and context() to find out information about the configuration of the window or to do additional drawing to it.
  10. use close() to destroy the context

Note: It is usually a good idea to use the MPxGlBuffer( M3dView &view ) form of the constructor to insure that the context created is done so correctly.

Functions

MPxGlBuffer:: MPxGlBuffer ()

Description

Construct an MPxGlBuffer for use with the currently active view. The buffer must match the view with respect to color index or RGB mode, depth, accumulation, and alpha buffers.

MPxGlBuffer:: MPxGlBuffer ( M3dView &view )

Description

Construct an MPxGlBuffer for use with a specified view. The buffer must match the view with respect to color index or RGB mode, depth, accumulation, and alpha buffers.

MPxGlBuffer:: ~MPxGlBuffer ()

MStatus MPxGlBuffer:: open ( short width, short height, GLXContext shareCtx )

Description

Create an actual buffer for the pixels of the specified size. If this function is not overridden, it will create an off-screen, hardware-accelerated buffer on UNIX systems. If you need to support some other hardware, you must override this function and create the actual off-screen buffer yourself.

Arguments

  • width width of the buffer to create
  • height height of the buffer to create
  • shareCtx a GLXContext that is used for shared texture maps, display lists, etc.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kInsufficientMemory Failed to allocate an off-screen buffer. This is a common occurrance on Impact graphics systems which only have enough memory for a single off-screen buffer. In fact SI graphics systems do not have any memory available for off-screen buffers despite the fact that the off-screen extension available. (It is available, you just cannot use it.)
  • MS::kNotFound Unable to find a frame buffer configuration or a visual that could be used with an off-screen buffer.
  • MS::kFailure Some other error prevented creation of an off-screen buffer.

GLXDrawable MPxGlBuffer:: drawable ( MStatus * ReturnStatus)

Description

Return the GLXDrawable to use for setting the current context.

Arguments

  • ReturnStatus

Return Value

  • GLXDrawable or NULL if the operation failed.

Status Codes

  • MS::kSuccess The GLXDrawable was successfully returned.
  • MS::kFailure Error getting the GLXDrawable.

GLXContext MPxGlBuffer:: context ( MStatus * ReturnStatus)

Description

Return the GLXContext to use for setting the current context.

Arguments

  • ReturnStatus

Return Value

  • GLXContext or NULL if the operation failed.

Status Codes

  • MS::kSuccess The GLXContext was successfully returned.
  • MS::kFailure Error getting the GLXContext.

XVisualInfo * MPxGlBuffer:: visual ( MStatus * ReturnStatus)

Description

Return the XVisualInfo used in creating the current context.

Arguments

  • ReturnStatus

Return Value

  • XVisualInfo pointer or NULL if the operation failed.

Status Codes

  • MS::kSuccess The XVisualInfo pointer was successfully returned.
  • MS::kFailure Error getting the XVisualInfo

Display * MPxGlBuffer:: display ( MStatus * ReturnStatus)

Description

Return the Display used for creating the current context.

Arguments

  • ReturnStatus

Return Value

  • Display pointer or NULL if the operation failed.

Status Codes

  • MS::kSuccess The Display pointer was successfully returned.
  • MS::kFailure Error getting the Display pointer.

int * MPxGlBuffer:: attributeList ( MStatus * ReturnStatus)

Description

Return the attributeList to be used for chosing the visual..

Arguments

  • ReturnStatus

Return Value

  • integer pointer or NULL if the operation failed.

Status Codes

  • MS::kSuccess The attribute list was successfully returned.
  • MS::kFailure Error getting the attribute list.

MStatus MPxGlBuffer:: setUseExternalDrawable ( bool state )

Description

Set to true if an external drawable will be provided. This will cause the attributeList to be constructed in the correct format. Do this before calling any other methods. It will ensure that the right attribute list or visual is created.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure internal error

MStatus MPxGlBuffer:: setDoubleBuffer ( bool state )

Description

Set to true if a double buffered visual should be used. Do this before calling any other methods. It will ensure that the right attribute list or visual is created. Drawing using M3dView::refresh() will always be to the back buffer.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure internal error

MStatus MPxGlBuffer:: setDisplay ( Display * disp )

Description

Set the display used to create the context

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure internal error

MStatus MPxGlBuffer:: setDrawable ( GLXDrawable drawable )

Description

Set the drawable. If no drawable is set, a pbuffer will be created.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure internal error

MStatus MPxGlBuffer:: setVisual ( XVisualInfo * vis )

Description

Set the visual. If no vusual is set, a visual will be chosen when it is needed.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure internal error

MStatus MPxGlBuffer:: close ()

Description

Close and deallocate the actual pixel buffer.

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure Error closing the buffer.

This class has no child classes.


Autodesk® Maya® 8.0 © 1997-2006 Autodesk, Inc. All rights reserved. doc++ Copyright