XFcGL class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcGL Class Reference

X-Forge Core Graphics Library. More...

List of all members.

## Public Member Functions

XFCIMPORT INT | recreate (UINT32 aDeviceId=XFCGLC_DEFAULT, UINT32 aFlags=XFCGLC_DEFAULT)
| Re-creates device without destroying the XFcGL object.
XFCIMPORT | XFcGL ()
| Constructor.
XFCIMPORT | ~XFcGL ()
| Destructor.
XFCIMPORT INT32 | beginRender ()
| Begins rendering block.
XFCIMPORT INT32 | endRender ()
| Ends rendering block.
XFCIMPORT INT32 | setViewport (XFcGLViewport &aViewport)
| Sets the currently active viewport.
XFCIMPORT INT32 | getViewport (XFcGLViewport &aViewport)
| Retrieves the currently active viewport.
XFCIMPORT INT32 | processVertices (XFcGLVertexBuffer &aSource, XFcGLVertexBuffer &aTarget, INT32 aOffset, INT32 aCount)
| Processes vertices.
XFCIMPORT INT32 | renderPrimitive (XFcGLVertexBuffer *aSource, INT32 aPrimitiveType, INT32 aOffset, INT32 aNumVertices, INT32 aFirstVertex, INT32 aLastVertex, XFcGLTriangleInfoBuffer *aTriangleInfo)
| Renders primitive(s).
XFCIMPORT INT32 | renderPrimitiveIndexed (XFcGLVertexBuffer *aSource, INT32 aPrimitiveType, INT32 aOffset, UINT16 *aIndexArray, INT32 aNumVertices, INT32 aFirstVertex, INT32 aLastVertex, XFcGLTriangleInfoBuffer *aTriangleInfo)
| Renders primitive(s) using index list.
XFCIMPORT INT32 | setLight (INT32 aIndex, XFcGLLight &aLight)
| Sets a light's data.
XFCIMPORT INT32 | getLight (INT32 aIndex, XFcGLLight &aLight)
| Gets specific light's data.
XFCIMPORT INT32 | enableLight (INT32 aIndex, INT aState)
| Enables or disables a light.
XFCIMPORT INT32 | setMatrix (INT32 aMatrixId, XFcMatrix4 &aMatrix)
| Sets the currently active matrix.
XFCIMPORT INT32 | getMatrix (INT32 aMatrixId, XFcMatrix4 &aMatrix)
| Gets the currently active matrix.
XFCIMPORT INT32 | setCustomCallback (XFcGLCustomRenderCallback *aCallback)
| Sets the custom renderer callback.
XFCIMPORT INT32 | setCustomCallbackData (INT32 aData)
| Sets the custom renderer data.
XFCIMPORT INT32 | setStateI (INT32 aStateId, INT32 aValue)
| Sets the value of a render state as an INT32.
XFCIMPORT INT32 | setStateF (INT32 aStateId, REAL aValue)
| Sets the value of a render state as a REAL.
XFCIMPORT INT32 | getStateI (INT32 aStateId, INT32 &aValue)
| Returns a render state value as an INT32.
XFCIMPORT INT32 | getStateF (INT32 aStateId, REAL &aValue)
| Returns a render state value as a REAL.
XFCIMPORT INT32 | validateBlendMode (INT32 aSrcBlend, INT32 aTgtBlend)
| Checks if a specific blend mode is supported.
XFCIMPORT INT32 | setTexture (XFcGLTexture *aTexture)
| Sets the current active texture.
XFCIMPORT XFcGLTexture * | getTexture ()
| Gets the current texture.
XFCIMPORT INT32 | setMaterial (XFcGLMaterial &aMaterial)
| Sets the current material.
XFCIMPORT INT32 | getMaterial (XFcGLMaterial &aMaterial)
| Gets the current material.
XFCIMPORT INT32 | drawSprite2d (REAL aCenterX, REAL aCenterY, REAL aZ, REAL aWidth, REAL aHeight, REAL aU0, REAL aV0, REAL aU1, REAL aV1, XFcMatrix4 *aTransformationMatrix, UINT32 aColor=0xffffff)
| Draws a 2D sprite using screen coordinates.
XFCIMPORT INT32 | drawSprite2d2 (REAL aX0, REAL aY0, REAL aZ, REAL aWidth, REAL aHeight, REAL aU0, REAL aV0, REAL aU1, REAL aV1, XFcMatrix4 *aTransformationMatrix, UINT32 aColor=0xffffffff)
| Draws a 2D sprite using screen coordinates.
XFCIMPORT INT32 | drawSprite3d (REAL aCenterX, REAL aCenterY, REAL aCenterZ, REAL aWidth, REAL aHeight, REAL aU0, REAL aV0, REAL aU1, REAL aV1, XFcMatrix4 *aTransformationMatrix, UINT32 aColor=0xffffffff)
| Draws a 3D sprite using world coordinates.
XFCIMPORT INT32 | drawSprite3dBillboard (REAL aCenterX, REAL aCenterY, REAL aCenterZ, REAL aWidth, REAL aHeight, REAL aU0, REAL aV0, REAL aU1, REAL aV1, XFcMatrix4 *aTransformationMatrix, UINT32 aColor=0xffffffff)
| Draws a 3D billboard sprite using world coordinates.
XFCIMPORT XFcGLSurface * | getSecondary ()
| Returns a pointer to the secondary buffer.
XFCIMPORT INT | setRenderTarget (XFcGLSurface *aSurface)
| Sets render target. Set to NULL for the framebuffer.
XFCIMPORT INT32 | getPalette (UINT8 **aPalette, UINT8 **aInvPalette)
| Returns pointer to the active palette. (Unused).
XFCIMPORT INT32 | setPalette (UINT8 *aPalette, UINT8 *aInvPalette)
| Sets the active palette. (Unused).
XFCIMPORT INT32 | clear (INT32 aColor=0, REAL aZBuffer=REALf(0), INT32 aFlags=0)
| Clears the framebuffer.

## Static Public Member Functions

XFCIMPORT const XFcGLDeviceInfo *const | getCurrentDeviceInfo ()
| Returns the device info for the currently active device.
XFCIMPORT const XFcGLDeviceInfo *const | getDeviceInfo ()
| Returns linked list of currently available devices.
XFCIMPORT XFcGL * | create (UINT32 aDeviceId=XFCGLC_DEFAULT, UINT32 aFlags=XFCGLC_DEFAULT)

## Protected Attributes

void * | mUnknown

## Detailed Description

X-Forge Core Graphics Library.

Note:
  XFcGL functions return values of XFCGLERRORS enum.

See also:
  XFCGLERRORS

## Constructor & Destructor Documentation

XFCIMPORT XFcGL::XFcGL | ( |  | ) |

| Constructor.

XFCIMPORT XFcGL::~XFcGL | ( |  | ) |

| Destructor.

## Member Function Documentation

XFCIMPORT INT32 XFcGL::beginRender | ( |  | ) |

| Begins rendering block. Everything that is supposed to be sorted should be between calls to beginRender() and endRender().

XFCIMPORT INT32 XFcGL::clear | ( | INT32 | aColor = 0,
|  | REAL | aZBuffer = REALf(0),
|  | INT32 | aFlags = 0
| ) |

Clears the framebuffer.

Parameters:

  aColor | Color used for filling the framebuffer in X8R8G8B8 format.
  aZBuffer | Z-value used for filling possible z-buffer.
  aFlags | Reserved.

XFCIMPORT XFcGL* XFcGL::create | ( | UINT32 | aDeviceId = XFCGLC_DEFAULT,
|  | UINT32 | aFlags = XFCGLC_DEFAULT
| ) | `[static]`

XFCIMPORT INT32 XFcGL::drawSprite2d | ( | REAL | aCenterX,
|  | REAL | aCenterY,
|  | REAL | aZ,
|  | REAL | aWidth,
|  | REAL | aHeight,
|  | REAL | aU0,
|  | REAL | aV0,
|  | REAL | aU1,
|  | REAL | aV1,
|  | XFcMatrix4 * | aTransformationMatrix,
|  | UINT32 | aColor = 0xffffff
| ) |

Draws a 2D sprite using screen coordinates.

Draws the sprite with polygons, so you can make transformations like Z-rotation on them. If you don't need any transformations, blitting a surface directly to the secondary buffer may be faster.

Parameters:

  aCenterX | center X-coordinate.
  aCenterY | center Y-coordinate.
  aZ | Z-coordinate.
  aWidth | width.
  aHeight | height.
  aU0 | first U-coordinate to the texture rectangle.
  aV0 | first V-coordinate to the texture rectangle.
  aU1 | second U-coordinate to the texture rectangle.
  aV1 | second V-coordinate to the texture rectangle.
  aTransformationMatrix | transformation matrix, or NULL if not needed.
  aColor | diffuse color.

Note:
  Transformations around center point.

See also:
  drawSprite2d2

XFCIMPORT INT32 XFcGL::drawSprite2d2 | ( | REAL | aX0,
|  | REAL | aY0,
|  | REAL | aZ,
|  | REAL | aWidth,
|  | REAL | aHeight,
|  | REAL | aU0,
|  | REAL | aV0,
|  | REAL | aU1,
|  | REAL | aV1,
|  | XFcMatrix4 * | aTransformationMatrix,
|  | UINT32 | aColor = 0xffffffff
| ) |

Draws a 2D sprite using screen coordinates.

Draws the sprite with polygons, so you can make transformations like Z-rotation on them. If you don't need any transformations, blitting a surface directly to the secondary buffer may be faster.

Parameters:

  aX0 | X-coordinate.
  aY0 | Y-coordinate.
  aZ | Z-coordinate.
  aWidth | width.
  aHeight | height.
  aU0 | first U-coordinate to the texture rectangle.
  aV0 | first V-coordinate to the texture rectangle.
  aU1 | second U-coordinate to the texture rectangle.
  aV1 | second V-coordinate to the texture rectangle.
  aTransformationMatrix | transformation matrix, or NULL if not needed.
  aColor | diffuse color.

Note:
  Transformations around center point.

  Unlike drawSprite2d, this method uses top-left sprite coordinates.

See also:
  drawSprite2d

XFCIMPORT INT32 XFcGL::drawSprite3d | ( | REAL | aCenterX,
|  | REAL | aCenterY,
|  | REAL | aCenterZ,
|  | REAL | aWidth,
|  | REAL | aHeight,
|  | REAL | aU0,
|  | REAL | aV0,
|  | REAL | aU1,
|  | REAL | aV1,
|  | XFcMatrix4 * | aTransformationMatrix,
|  | UINT32 | aColor = 0xffffffff
| ) |

Draws a 3D sprite using world coordinates.

Usually used with a transformation matrix to be really useful. To make a nailboard sprite, for instance, you'll need to create a transformation matrix that makes sure that the sprite rotates towards the camera around it's Y axis only.

Parameters:

  aCenterX | center X-coordinate.
  aCenterY | center Y-coordinate.
  aCenterZ | center Z-coordinate.
  aWidth | width.
  aHeight | height.
  aU0 | first U-coordinate to the texture rectangle.
  aV0 | first V-coordinate to the texture rectangle.
  aU1 | second U-coordinate to the texture rectangle.
  aV1 | second V-coordinate to the texture rectangle.
  aTransformationMatrix | transformation matrix, or NULL if not needed.
  aColor | diffuse color.

XFCIMPORT INT32 XFcGL::drawSprite3dBillboard | ( | REAL | aCenterX,
|  | REAL | aCenterY,
|  | REAL | aCenterZ,
|  | REAL | aWidth,
|  | REAL | aHeight,
|  | REAL | aU0,
|  | REAL | aV0,
|  | REAL | aU1,
|  | REAL | aV1,
|  | XFcMatrix4 * | aTransformationMatrix,
|  | UINT32 | aColor = 0xffffffff
| ) |

Draws a 3D billboard sprite using world coordinates.

Draws a billboard sprite (i.e. the sprite always faces the camera).

Parameters:

  aCenterX | center X-coordinate.
  aCenterY | center Y-coordinate.
  aCenterZ | center Z-coordinate.
  aWidth | width.
  aHeight | height.
  aU0 | first U-coordinate to the texture rectangle.
  aV0 | first V-coordinate to the texture rectangle.
  aU1 | second U-coordinate to the texture rectangle.
  aV1 | second V-coordinate to the texture rectangle.
  aTransformationMatrix | transformation matrix, or NULL if not needed.
  aColor | diffuse color.

XFCIMPORT INT32 XFcGL::enableLight | ( | INT32 | aIndex,
|  | INT | aState
| ) |

Enables or disables a light.

Note:
  Lighting is very expensive operation; use as few active lights as possible.

Parameters:

  aIndex | index number of the light.
  aState | 1 to enable the light, or 0 to disable the light.

XFCIMPORT INT32 XFcGL::endRender | ( |  | ) |

| Ends rendering block. Does actual rendering in software mode. Hardware implementations may render all the time.

XFCIMPORT const XFcGLDeviceInfo* const XFcGL::getCurrentDeviceInfo | ( |  | ) | `[static]`

| Returns the device info for the currently active device.

XFCIMPORT const XFcGLDeviceInfo* const XFcGL::getDeviceInfo | ( |  | ) | `[static]`

| Returns linked list of currently available devices.

XFCIMPORT INT32 XFcGL::getLight | ( | INT32 | aIndex,
|  | XFcGLLight & | aLight
| ) |

Gets specific light's data.

Parameters:

  aIndex | index number of the light.
  aLight | returned light data.

See also:
  XFcGLLight

XFCIMPORT INT32 XFcGL::getMaterial | ( | XFcGLMaterial & | aMaterial | ) |

Gets the current material.

Parameters:

  aMaterial | returned current material data.

XFCIMPORT INT32 XFcGL::getMatrix | ( | INT32 | aMatrixId,
|  | XFcMatrix4 & | aMatrix
| ) |

Gets the currently active matrix.

Parameters:

  aMatrixId | Matrix type, see XFCGLMATRIXID.
  aMatrix | returned active matrix.

See also:
  XFCGLMATRIXID

XFCIMPORT INT32 XFcGL::getPalette | ( | UINT8 ** | aPalette,
|  | UINT8 ** | aInvPalette
| ) |

| Returns pointer to the active palette. (Unused).

XFCIMPORT XFcGLSurface* XFcGL::getSecondary | ( |  | ) |

| Returns a pointer to the secondary buffer. Accessing the secondary buffer directly may cause stalls in the rendering pipeline, and in worst case the system may need to convert the framebuffer to the desired format and back on calls to lock/unlock. Blitting surfaces to the secondary should be fast, however.

XFCIMPORT INT32 XFcGL::getStateF | ( | INT32 | aStateId,
|  | REAL & | aValue
| ) |

Returns a render state value as a REAL.

Parameters:

  aStateId | State type, see XFCGLRENDERSTATES.
  aValue | REAL to store the result.

See also:
  XFCGLRENDERSTATES

  getStateI

Note:
  Unfortunately, making an overloaded method accepting both INT32 and REAL doesn't work, since compilers don't know whether to convert an enumeration to an integer or to a float.

XFCIMPORT INT32 XFcGL::getStateI | ( | INT32 | aStateId,
|  | INT32 & | aValue
| ) |

Returns a render state value as an INT32.

Parameters:

  aStateId | State type, see XFCGLRENDERSTATES.
  aValue | INT32 to store the result.

See also:
  XFCGLRENDERSTATES

  getStateF

Note:
  Unfortunately, making an overloaded method accepting both INT32 and REAL doesn't work, since compilers don't know whether to convert an enumeration to an integer or to a float.

XFCIMPORT XFcGLTexture* XFcGL::getTexture | ( |  | ) |

Gets the current texture.

Returns:
  a pointer to the currently active texture, or NULL if none.

XFCIMPORT INT32 XFcGL::getViewport | ( | XFcGLViewport & | aViewport | ) |

Retrieves the currently active viewport.

Parameters:

  aViewport | returned viewport settings.

XFCIMPORT INT32 XFcGL::processVertices | ( | XFcGLVertexBuffer & | aSource,
|  | XFcGLVertexBuffer & | aTarget,
|  | INT32 | aOffset,
|  | INT32 | aCount
| ) |

Processes vertices.

This method can be used to make special effects that require the same calculations as everything rendered. You do not need to call this for normal rendering.

Note:
  Source must not have RHW component, target must have it.

Parameters:

  aSource | source vertex buffer.
  aTarget | target vertex buffer.
  aOffset | offset in source buffer to start processing vertices from.
  aCount | number of vertices to process.

XFCIMPORT INT XFcGL::recreate | ( | UINT32 | aDeviceId = XFCGLC_DEFAULT,
|  | UINT32 | aFlags = XFCGLC_DEFAULT
| ) |

Re-creates device without destroying the XFcGL object.

Note:
  Resets all states.

XFCIMPORT INT32 XFcGL::renderPrimitive | ( | XFcGLVertexBuffer * | aSource,
|  | INT32 | aPrimitiveType,
|  | INT32 | aOffset,
|  | INT32 | aNumVertices,
|  | INT32 | aFirstVertex,
|  | INT32 | aLastVertex,
|  | XFcGLTriangleInfoBuffer * | aTriangleInfo
| ) |

Renders primitive(s).

Renders one or more triangles using current render states, matrices and textures.

Parameters:

  aSource | Source vertex buffer. See XFcGLVertexBuffer for details.
  aPrimitiveType | Primitive type, see XFCGLPRIMITIVETYPES.
  aOffset | Offset to the vertex buffer from which to start rendering.
  aNumVertices | Number of vertices to render (e.g. 3 for one triangle).
  aFirstVertex | Index to first vertex for rendering.
  aLastVertex | Index to last vertex for rendering.
  aTriangleInfo | Triangle info buffer.

See also:
  XFCGLPRIMITIVETYPES

XFCIMPORT INT32 XFcGL::renderPrimitiveIndexed | ( | XFcGLVertexBuffer * | aSource,
|  | INT32 | aPrimitiveType,
|  | INT32 | aOffset,
|  | UINT16 * | aIndexArray,
|  | INT32 | aNumVertices,
|  | INT32 | aFirstVertex,
|  | INT32 | aLastVertex,
|  | XFcGLTriangleInfoBuffer * | aTriangleInfo
| ) |

Renders primitive(s) using index list.

Renders one or more triangles using current render states, matrices and textures. Using this function instead of renderPrimitive() is often cheaper as the system doesn't need to do all the transformations for all vertices multiple times if several faces are using the same vertex.

Parameters:

  aSource | Source vertex buffer. See XFcGLVertexBuffer for details.
  aPrimitiveType | Primitive type, see XFCGLPRIMITIVETYPES.
  aOffset | Offset to the vertex buffer from which to start rendering
  aIndexArray | Pointer to a list of indices to the vertex buffer.
  aNumVertices | Number of indices to render (e.g. 3 for one triangle).
  aFirstVertex | Index to first vertex for rendering.
  aLastVertex | Index to last vertex for rendering.
  aTriangleInfo | Triangle info buffer.

See also:
  XFCGLPRIMITIVETYPES

XFCIMPORT INT32 XFcGL::setCustomCallback | ( | XFcGLCustomRenderCallback * | aCallback | ) |

Sets the custom renderer callback.

Parameters:

  aCallBack | pointer to the callback object.

XFCIMPORT INT32 XFcGL::setCustomCallbackData | ( | INT32 | aData | ) |

Sets the custom renderer data.

Parameters:

  aData | value that is passed to the custom render callback.

XFCIMPORT INT32 XFcGL::setLight | ( | INT32 | aIndex,
|  | XFcGLLight & | aLight
| ) |

Sets a light's data.

Parameters:

  aIndex | index number of the light.
  aLight | new light data.

See also:
  XFcGLLight

XFCIMPORT INT32 XFcGL::setMaterial | ( | XFcGLMaterial & | aMaterial | ) |

Sets the current material.

Parameters:

  aMaterial | new material data.

XFCIMPORT INT32 XFcGL::setMatrix | ( | INT32 | aMatrixId,
|  | XFcMatrix4 & | aMatrix
| ) |

Sets the currently active matrix.

Parameters:

  aMatrixId | Matrix type, see XFCGLMATRIXID.
  aMatrix | new active matrix.

See also:
  XFCGLMATRIXID

XFCIMPORT INT32 XFcGL::setPalette | ( | UINT8 * | aPalette,
|  | UINT8 * | aInvPalette
| ) |

| Sets the active palette. (Unused).

XFCIMPORT INT XFcGL::setRenderTarget | ( | XFcGLSurface * | aSurface | ) |

Sets render target. Set to NULL for the framebuffer.

Parameters:

  aSurface | new render target, or NULL for the framebuffer.

Note:
  Not supported in all rendering devices.

XFCIMPORT INT32 XFcGL::setStateF | ( | INT32 | aStateId,
|  | REAL | aValue
| ) |

Sets the value of a render state as a REAL.

Parameters:

  aStateId | State type, see XFCGLRENDERSTATES.
  aValue | Render state value as a REAL.

See also:
  XFCGLRENDERSTATES

  setStateI

Note:
  Unfortunately, making an overloaded method accepting both INT32 and REAL doesn't work, since compilers don't know whether to convert an enumeration to an integer or to a float.

XFCIMPORT INT32 XFcGL::setStateI | ( | INT32 | aStateId,
|  | INT32 | aValue
| ) |

Sets the value of a render state as an INT32.

Parameters:

  aStateId | State type, see XFCGLRENDERSTATES.
  aValue | Render state value as an INT32.

See also:
  XFCGLRENDERSTATES

  setStateF

Note:
  Unfortunately, making an overloaded method accepting both INT32 and REAL doesn't work, since compilers don't know whether to convert an enumeration to an integer or to a float.

XFCIMPORT INT32 XFcGL::setTexture | ( | XFcGLTexture * | aTexture | ) |

Sets the current active texture.

Parameters:

  aTexture | new active texture, or NULL to disable texturing.

XFCIMPORT INT32 XFcGL::setViewport | ( | XFcGLViewport & | aViewport | ) |

Sets the currently active viewport.

Parameters:

  aViewport | new viewport settings.

XFCIMPORT INT32 XFcGL::validateBlendMode | ( | INT32 | aSrcBlend,
|  | INT32 | aTgtBlend
| ) |

Checks if a specific blend mode is supported.

Since most blend mode combinations will not be supported by all hardware, you can use this function to determine, at runtime, if a blend mode is supported.

  Currently, the software renderer supports the following blend mode combinations:

  -      NONE   : src = ONE      tgt = ZERO

  -      ALPHA  : src = SRCALPHA tgt = INVSRCALPHA

  -      MUL    : src = ZERO     tgt = SRCCOLOR

  -      ADD    : src = ONE      tgt = ONE

  -      INVMUL : src = ZERO     tgt = INVSRCCOLOR

See also:
  XFCGLLEGALBLENDMODES

  XFCGLBLENDMODES

Parameters:

  aSrcBlend | Source blend mode, see XFCGLBLENDMOES.
  aTgtBlend | Target blend mode, see XFCGLBLENDMOES.

## Member Data Documentation

void* XFcGL::mUnknown`[protected]`

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch