Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

VizKit::VisualGraphics Class Reference

#include <VisualGraphics.h>

Collaboration diagram for VizKit::VisualGraphics:
Collaboration graph
[legend]

List of all members.

Classes

struct  GLCapabilities

Public Member Functions

void setGraphicsDevicePort (const GRAPHICS_DEVICE thePort)
void setCanvasRect (const TopLeftPositionedPixelRect &aCanvasRect)
void setTotalVisualizerRect (TopLeftPositionedPixelRect aRect)
void setTotalVisualizerRectVerticalOffsetFromBottom (int top, int height)
void isSetupForFullScreenMode (const bool isFullscreen)
BottomLeftPositionedPixelRect getCanvasRect (void)
PixelRect getScreenRect (void)
uint16 getBitsPerPixelOfScreen (void)
uint16 getRefreshRateOfScreen (void)
uint32 getCanvasPixelWidth (void)
uint32 getCanvasPixelHeight (void)
BottomLeftPositionedPixelRect getViewportRect (void)
Pixel getViewportBottomLeftOrigin (void)
RelationalRect getViewportOrientationAndAspectRatio (void)
bool setupContext ()
void disposeContext (void)
void setCanvasViewport (void)
void setSurfaceViewport (void)
void setOrthographicProjection (double maxLeftCoord, double maxRightCoord, double maxBottomCoord, double maxTopCoord, double maxNearPos, double maxFarPos, double zoomFactor=1.0)
void setPerspectiveProjection (double maxLeftCoord, double maxRightCoord, double maxBottomCoord, double maxTopCoord, double maxNearPos, double maxFarPos, double zoomFactor=1.0)
void loadModelViewIdentityMatrix (void)
void lookAt (Point3D eye, Point3D center, Vector up)
void setCanvasBackgroundColor (const RGBAColor &aColorVal)
RGBAColor getBackgroundColor (void)
void clearCanvasBackground (void)
void clearSurfaceBackground (void)
void setPixelStorageParams (void)
void resetModelViewMatrix (void)
void translateMatrix (double xNum, double yNum, double zNum)
void rotateMatrix (double angle, double xAmount, double yAmount, double zAmount)
void scaleMatrix (double xFactor, double yFactor, double zFactor)
void enableTexturing (bool useRectExtension)
void disableTexturing (bool useRectExtension)
void bindTexture (uint32 textureName, bool useRectExtension)
void getPixelsOfCurrentTexture (bool useRectExtension, uint16 format, uint16 type, uint32 **buffer)
void enableAlphaBlending (void)
void disableBlending (void)
void setColor (const RGBAColor &theColor)
void setLineWidth (double width)
void enableDepthTest (void)
void disableDepthTest (void)
void enableCullFace (void)
void disableCullFace (void)
void cullFaceFront (void)
void cullFaceBack (void)
uint8 getOpenGLError (char *outErrorString)
uint16 setCurrentContext (void)
void finishGLDrawing (void)
int getCurrentColorBufferForPixelReadingOperations (void)
int getCurrentColorBufferForPixelDrawingOperations (void)
void setColorBufferForPixelReadingOperations (int colorBuffer)
void setColorBufferForPixelDrawingOperations (int colorBuffer)
void drawTexture (uint32 textureNumber, const VertexChain *const vertexChain, bool canUseRectExtension, BlendMode aBlendMode=kBlend, bool debug=false)
void drawVertexChain (const VertexChain &vertexChain, int drawMode=kGL_LINE_LOOP, BlendMode aBlendMode=kReplace)
void drawDebugVertexChain (const VertexChain &vertexChain, const VisualCamera &aCamera)
void drawPixels (PixelColor **pixelData, double xCoord, double yCoord, uint32 width, uint32 height, uint16 format, uint16 dataType, const VisualConvolutionFilter *const aConvolutionFilter=NULL)
void resample (uint16 formatIn, uint32 widthIn, uint32 heightIn, uint16 dataTypeIn, PixelColor *pixelDataIn, uint32 widthOut, uint32 heightOut, uint16 dataTypeOut, PixelColor **pixelDataOut)
void readPixels (double xCoord, double yCoord, uint32 width, uint32 height, uint32 **pixelData, uint16 format, uint16 dataType, const VisualCamera &aCamera)
void drawSpot (const double xNum, const double yNum, const double r, const double g, const double b, uint16 waveformIntensityVal, double intensity, const uint8 tailSize)
void drawTriangle (void)
void spotGL (double zPlane=0.0)
void drawProjectionMetrics (const VisualCamera &aCamera)
Coord getCirclePoint (uint32 sliceIdx, uint32 slicesCount, double radius=1.0, Coord circleCenter=zeroCoord)
void drawBeatHistogram (const uint32 *const beatHistogram, const VisualCamera &aCamera)
bool canUseTextureRectExtension (void)
bool doesSupportGLConvolutionFilter (void)
void drawWaveform (const sint16 historyNum, const uint16 maxNumberOfHistories, const uint32 numberOfWaveformEntries, sint16 **waveformDataMonoArray, const VisualCamera &aCamera)
void drawWaveformSpiral (const uint16 currHistoryNum, const uint16 numberOfWaveformEntries, const sint16 *const waveformDataMonoArray)
void drawSpectrumAnalyzer (const sint16 currHistoryNum, const uint16 numberOfHistories, const uint32 numberOfSpectrumEntries, const uint16 numberOfAudioChannels, const uint8 ***const spectrumDataArray, const VisualCamera &aCamera)
void drawSpectrogram (const sint16 currHistoryNum, const uint16 numberOfHistories, const uint32 numberOfSpectrumEntries, const uint16 numberOfAudioChannels, const uint8 ***const spectrumDataArray, const VisualCamera &aCamera)
void drawWaveformCircle (const float xNum, const float yNum, const float rotVal, const float radius)
void drawCStringWithGL (const char *const cString, const uint16 stringLength)
void doFallbackActorShow (const char *const visualActorName)
float getCosTwoTimesPi (void)
float getSinTwoTimesPi (void)
uint32 getNextFreeTextureName (void)
void deleteTextures (const uint16 numberOfTextures, const uint32 *const textureNames)
void showProcessInfoRow (Coord coord, const char *const textRowStr)
void showProcessInfoNote (void)
PixelColorclipPixelData (const PixelColor *inPixelData, const PixelRect &inPixelRect, const TopLeftPositionedPixelRect &clipRect)
bool copyARGBBitmapDataToTexture (uint32 textureNumber, uint32 imageWidth, uint32 imageHeight, bool canUseRectExtension, const PixelColor **bitmapData, bool debug=false)
const char *const getRendererName (void)
const char *const getRendererVendor (void)
const char *const getRendererVersion (void)
unsigned short getGLVersion (void)
long getMaxTextureSize (void)
double xPixelToCoord (uint32 pixelPos, const VisualCamera &aCamera)
double yPixelToCoord (uint32 pixelPos, const VisualCamera &aCamera)
uint16 xCoordToPixel (double coordPos, const VisualCamera &aCamera)
uint16 yCoordToPixel (double coordPos, const VisualCamera &aCamera)
bool getCoordsOfPixelPosition (double xPixelPos, double yPixelPos, double zAxisPos, double *xCoordPos, double *yCoordPos, double *zCoordPos)
bool getPixelsOfCoordPosition (double xCoordPos, double yCoordPos, double zCoordPos, double *xPixelPos, double *yPixelPos, double *zAxisPos)
void gatherOpenGLCapabilities (void)
VisualNurbscreateNurbsObject (const VisualItemIdentifier &identifier, uint8 sNumKnots, float *sKnots, uint8 tNumKnots, float *tKnots, uint16 sStride, uint16 tStride, uint16 sOrder, uint16 tOrder)
void deleteNurbsObject (const VisualItemIdentifier &identifier)
VisualNurbsgetNurbsObject (const VisualItemIdentifier &identifier)
void copyFramebufferToTexture (uint32 textureNumber, bool canUseRectExtension, const BottomLeftPositionedPixelRect &clipRect, uint16 pixelFormat, uint16 dataType)
uint32 power2Ceiling (uint32 n)

Static Public Member Functions

static VisualGraphicsgetInstance (void)
static void dispose (void)
static bool isInitialized (void)
static void drawHistoryDiagram (std::vector< double > &aVector, size_t baseIdx, double minVal, double maxVal, const VisualCamera &aCamera)

Private Types

typedef std::map
< VisualItemIdentifier,
VisualNurbs * > 
NurbsMap
typedef NurbsMap::iterator NurbsMapIterator

Private Member Functions

 VisualGraphics ()
 ~VisualGraphics ()
 VisualGraphics (const VisualGraphics &other)
VisualGraphicsoperator= (const VisualGraphics &other)

Private Attributes

BottomLeftPositionedPixelRect canvasRect
BottomLeftPositionedPixelRect surfaceRect
uint32 surfaceRectVerticalOffsetFromBottom
bool isSetUpOnFullscreen
RGBAColor canvasBackgroundColor
RGBAColor surfaceBackgroundColor
GLCapabilities capabilities
NurbsMap nurbsMap

Static Private Attributes

static VisualGraphicstheVisualGraphics = NULL

Detailed Description

Communicates with the graphics device. Language of choice is OpenGL. Any function needing drawing can use a method of Visual Graphics class. That way only the header file of Visual Graphics needs to be included and no strong binding to a specific graphics language is needed inside other classes than this one.


Member Typedef Documentation

A NurbsMap is a map of an identifier string and a pointer to a VisualNurbs.

typedef NurbsMap::iterator VizKit::VisualGraphics::NurbsMapIterator [private]

A NurbsMapIterator is an iterator of a NurbsMap.


Constructor & Destructor Documentation

VisualGraphics::VisualGraphics (  )  [private]

The constructor. VisualGraphics is a singleton class. The constructor is private. New instance of class can only be created internally.

VisualGraphics::~VisualGraphics (  )  [private]

The destructor. VisualGraphics is a singleton class. The destructor is private. Instance of class can only be destructed internally.

VizKit::VisualGraphics::VisualGraphics ( const VisualGraphics other  )  [private]

Copy constructor.

Parameters:
other Another VisualGraphics.
Remarks:
Explicitely declared in private section and not implemented to enforce uniqueness of singleton pattern.

Member Function Documentation

void VisualGraphics::bindTexture ( uint32  textureName,
bool  useRectExtension 
)

Binds a texture (sets it current) by calling glBindTexture().

Parameters:
textureName The name/number/id of the texture.
useRectExtension If true texture is bound with GL_TEXTURE_RECTANGLE_EXT, if false texture is bound with GL_TEXTURE_2D.
bool VisualGraphics::canUseTextureRectExtension ( void   ) 

The function queries the system and answers whether textures can have non power of 2 dimensions.

Returns:
true if graphics system does support rectangular texture extension, false otherwise.
void VisualGraphics::clearCanvasBackground ( void   ) 

Clears the canvas region with the background color.

void VisualGraphics::clearSurfaceBackground ( void   ) 

Clears the surface region with the background color.

Remarks:
The surface region is the canvas surrounding region.
PixelColor * VisualGraphics::clipPixelData ( const PixelColor inPixelData,
const PixelRect inPixelRect,
const TopLeftPositionedPixelRect clipRect 
)

Creates clipped pixel data.

Parameters:
inPixelData Pixel data to be clipped.
inPixelRect Dimensions of pixel data.
clipRect Dimensions of the clip rect.
Returns:
The clipped pixel data.
Remarks:
The caller has to deallocate the returned pixel data with free().
bool VisualGraphics::copyARGBBitmapDataToTexture ( uint32  textureNumber,
uint32  imageWidth,
uint32  imageHeight,
bool  canUseRectExtension,
const PixelColor **  bitmapData,
bool  debug = false 
)

Copies ARGB bitmap data into texture.

Parameters:
textureNumber The texture number (texture name) of the generated texture.
imageWidth The width of the bitmap data (width of texture might differ because of normalization to power-of-two value).
imageHeight The height of the bitmap data (height of texture might differ because of normalization to power-of-two value).
canUseRectExtension True if the texture does support rectangular texture extension. False otherwise.
bitmapData Pointer to pointer to the bitmap data.
debug If true, prebuilt pixel data is used.
Returns:
True on success, false on failure.
void VisualGraphics::copyFramebufferToTexture ( uint32  textureNumber,
bool  canUseRectExtension,
const BottomLeftPositionedPixelRect clipRect,
uint16  pixelFormat,
uint16  dataType 
)

Copies the content of a screen rectangle into a texture buffer.

Parameters:
textureNumber The number/id/name of the texture.
canUseRectExtension True if graphics system does support rectangular texture extension. False otherwise. Default false.
clipRect The dimensions and position of the clip rect.
pixelFormat The format of the pixels (kGL_RGBA, kGL_LUMINANCE).
dataType The data type of the pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
Remarks:
The pixels are copied from the framebuffer.
VisualNurbs * VisualGraphics::createNurbsObject ( const VisualItemIdentifier identifier,
uint8  sNumKnots,
float *  sKnots,
uint8  tNumKnots,
float *  tKnots,
uint16  sStride,
uint16  tStride,
uint16  sOrder,
uint16  tOrder 
)

Creates a NURBS object and returns a pointer to it.

Parameters:
identifier Identifier of the NURBS. The Nurbs can later be addressed by that token.
sNumKnots The number of knots in horizontal direction.
sKnots An array of horizontal knot values.
tNumKnots The number of knots in vertical direction.
tKnots An array of vertical knot values.
sStride The offset between successive control points in u direction.
tStride The offset between successive control points in v direction.
sOrder The order of the NURBS surface in u direction.
tOrder The order of the NURBS surface in v direction.
Returns:
The newly created NURBS object with the identifierName.
void VisualGraphics::cullFaceBack ( void   ) 

Specifies that back-facing facets can be culled.

void VisualGraphics::cullFaceFront ( void   ) 

Specifies that front-facing facets can be culled.

void VisualGraphics::deleteNurbsObject ( const VisualItemIdentifier identifier  ) 

Deletes a NURBS object.

Parameters:
identifier The identifier of the NURBS.
void VisualGraphics::deleteTextures ( const uint16  numberOfTextures,
const uint32 *const   textureNames 
)

Frees memory bound by OpenGL textures.

Parameters:
numberOfTextures The number of textures to free.
textureNames Pointer to texture names (texture numbers) to free.
void VisualGraphics::disableBlending ( void   ) 

Disables blending by calling glDisable(GL_BLEND).

void VisualGraphics::disableCullFace ( void   ) 

Disables GL_CULL_FACE.

void VisualGraphics::disableDepthTest ( void   ) 

Disables GL_DEPTH_TEST.

void VisualGraphics::disableTexturing ( bool  useRectExtension  ) 

Disables texturing by calling glDisable(GL_TEXTURE_2D) or glDisable(GL_TEXTURE_RECTANGLE_EXT).

Parameters:
useRectExtension If true texturing is disabled with GL_TEXTURE_RECTANGLE_EXT, if false texturing is disabled with GL_TEXTURE_2D.
void VisualGraphics::dispose ( void   )  [static]

Cleans up the Visual Graphics singleton class.

void VisualGraphics::disposeContext ( void   ) 

Tears down the OpenGL allocations.

bool VisualGraphics::doesSupportGLConvolutionFilter ( void   ) 

The function queries the system and answers whether convolution filter can be performed with OpenGL system.

Returns:
true if graphics system does support convolution filter, false otherwise.
void VisualGraphics::doFallbackActorShow ( const char *const   visualActorName  ) 

The default implementation of the show() method of the VisualActor interface class.

Parameters:
visualActorName The name of the VisualActor.
void VisualGraphics::drawBeatHistogram ( const uint32 *const   beatHistogram,
const VisualCamera aCamera 
)

Draws a histogram of the beat values.

Parameters:
beatHistogram The beat histogram.
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawCStringWithGL ( const char *const   cString,
const uint16  stringLength 
)

Draws a 7bit char buffer string to screen. Mac uses GLUT_BITMAP_9_BY_15. Win uses Arial font created by wglUseFontBitmaps.

void VisualGraphics::drawDebugVertexChain ( const VertexChain vertexChain,
const VisualCamera aCamera 
)

Draws debug information of a vertex chain. Useful for debugging, monitoring or diagnistic purposes.

Parameters:
vertexChain A vector of vertices.
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawHistoryDiagram ( std::vector< double > &  aVector,
size_t  baseIdx,
double  minVal,
double  maxVal,
const VisualCamera aCamera 
) [static]

Draws the data of a vector.

Parameters:
aVector Reference to a vextor that holds the data.
baseIdx The current start index.
minVal The (possible) minumum value. The value is used for calculating the vertical dimension of the diagram.
maxVal The (possible) maximum value. The value is used for calculating the vertical dimension of the diagram.
Remarks:
The vector can act as a ringbuffer by letting baseIdx point to the current start of the vector.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawPixels ( PixelColor **  pixelData,
double  xCoord,
double  yCoord,
uint32  width,
uint32  height,
uint16  format,
uint16  dataType,
const VisualConvolutionFilter *const   aConvolutionFilter = NULL 
)

Draws image data to framebuffer.

Parameters:
pixelData Pointer to pointer to image data.
xCoord The bottom left x coord.
yCoord The bottom top y coord.
width The width of the rectangle.
height The height of the rectangle.
format The format of the pixels (kGL_RGBA, kGL_LUMINANCE).
dataType The data type of the pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
aConvolutionFilter An optional convolution filter that is used when drawing the pixels.
void VisualGraphics::drawProjectionMetrics ( const VisualCamera aCamera  ) 

Draws some metrics in the current scene.

Remarks:
For diagnostical puposes.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawSpectrogram ( const sint16  currHistoryNum,
const uint16  numberOfHistories,
const uint32  numberOfSpectrumEntries,
const uint16  numberOfAudioChannels,
const uint8 ***const   spectrumDataArray,
const VisualCamera aCamera 
)

Draws a graphical representation of the spectral data as spectrogram.

Parameters:
currHistoryNum The index of the history the spectrum data is taken from.
numberOfHistories The maximum number of histories.
numberOfSpectrumEntries The number of spectrum data values.
numberOfAudioChannels The number of audio channels.
spectrumDataArray Pointer to spectrum data of all histories.
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawSpectrumAnalyzer ( const sint16  currHistoryNum,
const uint16  numberOfHistories,
const uint32  numberOfSpectrumEntries,
const uint16  numberOfAudioChannels,
const uint8 ***const   spectrumDataArray,
const VisualCamera aCamera 
)

Draws a graphical representation of the spectral data with subband bar graphs.

Parameters:
currHistoryNum The index of the history the spectrum data is taken from.
numberOfHistories The maximum number of histories.
numberOfSpectrumEntries The number of spectrum data values.
numberOfAudioChannels The number of audio channels.
spectrumDataArray Pointer to spectrum data of all histories.
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawSpot ( const double  xNum,
const double  yNum,
const double  r,
const double  g,
const double  b,
uint16  waveformIntensityVal,
double  intensity,
const uint8  tailSize 
)

Draws a single spot.

Parameters:
xNum The horizontal position of the spot.
yNum The vertical position of the spot.
r The red component of the RGB-Color.
g The green component of the RGB-Color.
b The blue component of the RGB-Color.
waveformIntensityVal The current radius of the spot.
intensity The current intensity of the spot.
tailSize The current tailSize of the spot.
void VisualGraphics::drawTexture ( uint32  textureNumber,
const VertexChain *const   vertexChain,
bool  canUseRectExtension,
BlendMode  aBlendMode = kBlend,
bool  debug = false 
)

Draws a texture on screen. If the texture is stored in texture memory, this function can be called to put the texture on screen.

Parameters:
textureNumber The number/id/name of the texture.
vertexChain A vector of vertices.
canUseRectExtension True if graphics system does support rectangular texture extension. False otherwise.
aBlendMode How to blend texture data with the framebuffer data. Default kBlend.
debug If true the position numbers are displayed.
void VisualGraphics::drawTriangle ( void   ) 

Draws a triangle. For testing purposes.

void VisualGraphics::drawVertexChain ( const VertexChain vertexChain,
int  drawMode = kGL_LINE_LOOP,
BlendMode  aBlendMode = kReplace 
)

Draws a vertex chain. Useful for debugging, monitoring or diagnistic purposes.

Parameters:
vertexChain A vector of vertices.
drawMode The requested draw mode (kGL_POINTS, kGL_LINES, kGL_LINE_STRIP, kGL_LINE_LOOP, kGL_TRIANGLES, kGL_TRIANGLE_STRIP, kGL_TRIANGLE_FAN, kGL_QUADS, kGL_QUAD_STRIP, kGL_POLYGON).
aBlendMode How to blend vertex chain drawing with the framebuffer data. Default kReplace.
void VisualGraphics::drawWaveform ( const sint16  historyNum,
const uint16  maxNumberOfHistories,
const uint32  numberOfWaveformEntries,
sint16 **  waveformDataMonoArray,
const VisualCamera aCamera 
)

Draws the waveform data.

Parameters:
historyNum The index of the history the waveform data is taken from.
maxNumberOfHistories Maximum number of histories stored in waveformDataMonoArray.
numberOfWaveformEntries The number of waveform values.
waveformDataMonoArray Pointer to waveform data of all histories. The array has two dimensions: history and index.
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawWaveformCircle ( const float  xNum,
const float  yNum,
const float  rotVal,
const float  radius 
)

Draws a circle representing the waveform data.

Parameters:
xNum The horizontal position.
yNum The vertical position.
rotVal The degree of rotation.
radius Radius.
void VisualGraphics::drawWaveformSpiral ( const uint16  currHistoryNum,
const uint16  numberOfWaveformEntries,
const sint16 *const   waveformDataMonoArray 
)

Draws the waveform data in spiral form.

Parameters:
currHistoryNum The current history of the waveform data.
numberOfWaveformEntries The number of waveform values.
waveformDataMonoArray Pointer to waveform data of all histories.
void VisualGraphics::enableAlphaBlending ( void   ) 

Enables blending by calling glEnable(GL_BLEND) followed by function glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). The alpha value of the source is taken and blended with the destination color values.

void VisualGraphics::enableCullFace ( void   ) 

Enables GL_CULL_FACE.

void VisualGraphics::enableDepthTest ( void   ) 

Enables GL_DEPTH_TEST.

void VisualGraphics::enableTexturing ( bool  useRectExtension  ) 

Enables texturing by calling glEnable(GL_TEXTURE_2D) or glEnable(GL_TEXTURE_RECTANGLE_EXT).

Parameters:
useRectExtension If true texturing is enabled with GL_TEXTURE_RECTANGLE_EXT, if false texturing is enabled with GL_TEXTURE_2D.
void VisualGraphics::finishGLDrawing ( void   ) 

Ends the GL drawing by flushing, finishing and swaping the buffer content. Every executed drawing command should show its result on screen. The function is called at the end of each RenderMessage.

void VisualGraphics::gatherOpenGLCapabilities ( void   ) 

Determines the openGL capabilities and stores them internally.

RGBAColor VisualGraphics::getBackgroundColor ( void   ) 

Returns the value of the canvas background color.

Returns:
The RGBA values of the canvas background color.
uint16 VisualGraphics::getBitsPerPixelOfScreen ( void   ) 

Returns the current number of bits per pixel of the frame buffer.

Returns:
The current number of bits per pixel of the frame buffer.
uint32 VisualGraphics::getCanvasPixelHeight ( void   ) 

Returns the height of the canvas in pixels.

Returns:
The height of the canvas in pixels.
uint32 VisualGraphics::getCanvasPixelWidth ( void   ) 

Returns the width of the canvas in pixels.

Returns:
The width of the canvas in pixels.
BottomLeftPositionedPixelRect VisualGraphics::getCanvasRect ( void   ) 

Returns the draw rect positioned relative to window rect.

Coord VisualGraphics::getCirclePoint ( uint32  sliceIdx,
uint32  slicesCount,
double  radius = 1.0,
Coord  circleCenter = zeroCoord 
)

Returns a point on the outline of a circle.

Parameters:
sliceIdx The index of the requested slice.
slicesCount The number of slices.
radius The length of the radius. Default = 1.0.
circleCenter The center of the circle. Default is x = 0.0 and y = 0.0.
Remarks:
The center of the circle is at 0.0, 0.0. The number of slices determine how close the circle points are located to each other. The circle points start at the rightmost position in the middle of the circle (at 3 o'clock) and go in counter clockwise direction.
bool VisualGraphics::getCoordsOfPixelPosition ( double  xPixelPos,
double  yPixelPos,
double  zAxisPos,
double *  xCoordPos,
double *  yCoordPos,
double *  zCoordPos 
)

Maps window coordinates to object coordinates.

Parameters:
xPixelPos The horizontal pixel position.
yPixelPos The vertical pixel position.
zAxisPos The position on the z-axis. 0: near clipping plane, 1: far clipping plane.
xCoordPos Returns: The x-CoordPosition.
yCoordPos Returns: The y-CoordPosition.
zCoordPos Returns: The z-CoordPosition.
Returns:
True on success, false on error.
float VisualGraphics::getCosTwoTimesPi ( void   ) 

Returns cos(2.0 * _PI).

Returns:
cos(2.0 * _PI).
int VisualGraphics::getCurrentColorBufferForPixelDrawingOperations ( void   ) 

Returns the current color buffer specification for drawing pixels.

Returns:
The current color buffer specification for drawing pixels.
int VisualGraphics::getCurrentColorBufferForPixelReadingOperations ( void   ) 

Returns the current color buffer specification for reading pixels.

Returns:
The current color buffer specification for reading pixels.
unsigned short VisualGraphics::getGLVersion ( void   ) 

Returns the version of OpenGL.

Returns:
The version of OpenGL.
VisualGraphics * VisualGraphics::getInstance ( void   )  [static]

Returns a pointer to the instance. Initializes the Visual Graphics class if neccessary. The visual graphics class is of singleton type.

Returns:
A pointer to the initialized VisualGraphics.
long VisualGraphics::getMaxTextureSize ( void   ) 

Returns the maximum texture size.

Returns:
the maximum texture size.
uint32 VisualGraphics::getNextFreeTextureName ( void   ) 

Returns a free texture name/index/number/id.

Returns:
A free texture name/index/number.
VisualNurbs * VisualGraphics::getNurbsObject ( const VisualItemIdentifier identifier  ) 

Returns a pointer to a NURBS object.

Parameters:
identifier The identifier of the NURBS.
Returns:
The NURBS object with the identifier.
uint8 VisualGraphics::getOpenGLError ( char *  outErrorString  ) 

Returns an error string (if there was an error).

Parameters:
[out] outErrorString Pointer to character buffer to receive the error string.
Returns:
Error number.
bool VisualGraphics::getPixelsOfCoordPosition ( double  xCoordPos,
double  yCoordPos,
double  zCoordPos,
double *  xPixelPos,
double *  yPixelPos,
double *  zAxisPos 
)

Maps object coordinates to window coordinates.

Parameters:
xCoordPos The x-CoordPosition.
yCoordPos The y-CoordPosition.
zCoordPos The z-CoordPosition.
xPixelPos Returns: The horizontal pixel position.
yPixelPos Returns: The vertical pixel position.
zAxisPos Returns: The position on the z-axis.
Returns:
True on success, false on error.
void VisualGraphics::getPixelsOfCurrentTexture ( bool  useRectExtension,
uint16  format,
uint16  type,
uint32 **  buffer 
)

Writes the pixels of the current texture (last one binded) into the provided buffer.

Parameters:
useRectExtension If true texture has rectangular dimensions.
format The format of the pixels (kGL_RGBA, kGL_LUMINANCE).
type The data type of the pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
[out] buffer Pointer to pointer to allocated buffer of 32bit chunks (one chunk is one pixel with four 8bit channels).
uint16 VisualGraphics::getRefreshRateOfScreen ( void   ) 

Returns the current refresh rate of the screen. Can return 0 if refresh rate can't be determined.

Returns:
The current refresh rate of the screen.
const char *const VisualGraphics::getRendererName ( void   ) 

Returns the name of the renderer of the graphic card.

Returns:
The name of the renderer of the graphic card.
const char *const VisualGraphics::getRendererVendor ( void   ) 

Returns the name of the vendor of the graphic card.

Returns:
The name of the vendor of the graphic card.
const char *const VisualGraphics::getRendererVersion ( void   ) 

Returns the version of the renderer.

Returns:
The version of the renderer.
PixelRect VisualGraphics::getScreenRect ( void   ) 

Returns the current dimensions of the screen.

Returns:
The current dimensions of the screen.
float VisualGraphics::getSinTwoTimesPi ( void   ) 

Returns sin(2.0 * _PI).

Returns:
sin(2.0 * _PI).
Pixel VisualGraphics::getViewportBottomLeftOrigin ( void   ) 

Returns the bottom-left positioned origin of the viewport rect.

Returns:
The bottom-left positioned origin of the viewport rect.
RelationalRect VisualGraphics::getViewportOrientationAndAspectRatio ( void   ) 

Returns the current orientation and aspect ratio of the viewport.

Returns:
The current orientation and aspect ratio of the viewport.
BottomLeftPositionedPixelRect VisualGraphics::getViewportRect ( void   ) 

Returns the dimensions and position of the current OpenGL viewport.

Returns:
The dimensions and position of the current OpenGL viewport.
bool VisualGraphics::isInitialized ( void   )  [static]

Answers the question whether the Visual Graphics singleton class is initialized or not.

Returns:
True if VisualGraphics singleton class is initialized. False if not.
void VisualGraphics::isSetupForFullScreenMode ( const bool  isFullscreen  ) 

Stores whether the visualizer is expected to show in fullscreen mode or in windowed mode.

Parameters:
isFullscreen True if fullscreen mode is expected. False if windowed mode is expected.
void VisualGraphics::loadModelViewIdentityMatrix ( void   ) 

Loads the identity matrix of the model view. The model view transformation are reset

Remarks:
It is assumed the model view is the currently active matrix mode.
void VisualGraphics::lookAt ( Point3D  eye,
Point3D  center,
Vector  up 
)

Performs a viewing transformation.

Parameters:
eye The position of the eye point.
center The position of the reference point.
up the direction of the up vector.
VisualGraphics& VizKit::VisualGraphics::operator= ( const VisualGraphics other  )  [private]

Assignment operator.

Remarks:
Explicitely declared in private section and not implemented to enforce uniqueness of singleton pattern.
uint32 VisualGraphics::power2Ceiling ( uint32  n  ) 

Returns the nearest power of 2 integer following the input integer.

Parameters:
n The input integer.
Returns:
A power of 2 integer.
void VisualGraphics::readPixels ( double  xCoord,
double  yCoord,
uint32  width,
uint32  height,
uint32 **  pixelData,
uint16  format,
uint16  dataType,
const VisualCamera aCamera 
)

Reads image data from framebuffer into processor memory.

Parameters:
xCoord The bottom left x coord.
yCoord The bottom top y coord.
width The width of the rectangle.
height The height of the rectangle.
[out] pixelData Pointer to pointer of buffer to write image data to.
format The format of the requested pixels (kGL_RGBA, kGL_LUMINANCE).
dataType The data type of the requested pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::resample ( uint16  formatIn,
uint32  widthIn,
uint32  heightIn,
uint16  dataTypeIn,
PixelColor pixelDataIn,
uint32  widthOut,
uint32  heightOut,
uint16  dataTypeOut,
PixelColor **  pixelDataOut 
)

Resamples (resizes) pixel data according to the passed-in dimensions.

Parameters:
formatIn The format of the incoming pixels (kGL_RGBA, kGL_LUMINANCE).
widthIn The width of the incoming pixels.
heightIn The width of the incoming pixels.
dataTypeIn The data type of the incoming pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
pixelDataIn A pointer to the incoming pixel data.
widthOut The requested width of the outgoing pixels.
heightOut The requested height of the outgoing pixels.
dataTypeOut The requested data type of the outgoing pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
pixelDataOut A pointer to a pointer to the outgoing pixel data. The memory has to be allocated an freed by the caller.
void VisualGraphics::resetModelViewMatrix ( void   ) 

Resets the model view matrix.

void VisualGraphics::rotateMatrix ( double  angle,
double  xAmount,
double  yAmount,
double  zAmount 
)

Call of glRotate().

Parameters:
angle The angle of the rotation.
xAmount The amount of the rotation around the horizontal axis.
yAmount The amount of the rotation around the vertical axis.
zAmount The amount of the rotation around the z-axis.
void VisualGraphics::scaleMatrix ( double  xFactor,
double  yFactor,
double  zFactor 
)

Call of glScale().

Parameters:
xFactor The scale factor in the horizontal dimension.
yFactor The scale factor in the vertical dimension.
zFactor The scale factor in the z-dimension.
void VisualGraphics::setCanvasBackgroundColor ( const RGBAColor aColorVal  ) 

Sets the value of the canvas background color.

Parameters:
aColorVal The RGBA values.
void VisualGraphics::setCanvasRect ( const TopLeftPositionedPixelRect aCanvasRect  ) 

Stores the canvas rect. The canvas rect defines the rectangle where the drawing takes place. The rectangle is passed in by iTunes and can be scaled in fullscreen mode.

Parameters:
aCanvasRect Rectangle dimensions.
Remarks:
The values of the TopLeftPositionedPixelRect are converted and stored internally as BottomLeftPositionedPixelRect values.
void VisualGraphics::setCanvasViewport ( void   ) 

Sets up the viewport according to current dimensions of canvasRect.

void VisualGraphics::setColor ( const RGBAColor theColor  ) 

Sets a color value by calling glColor().

Parameters:
theColor The color values to set.
void VisualGraphics::setColorBufferForPixelDrawingOperations ( int  colorBuffer  ) 

Sets the color buffer specification for drawing pixels.

Parameters:
colorBuffer The color buffer to use for drawing pixels.
void VisualGraphics::setColorBufferForPixelReadingOperations ( int  colorBuffer  ) 

Sets the color buffer specification for reading pixels.

Parameters:
colorBuffer The color buffer to use for reading pixels.
uint16 VisualGraphics::setCurrentContext ( void   ) 

Sets the current context to the one that has been set up before with the setupContext() call.

Returns:
errNum: 0 if no error, > 0 error.
Remarks:
The context must be set back to the one set up initially with each render action in case Cover Flow did change it in the meantime.
void VisualGraphics::setGraphicsDevicePort ( const GRAPHICS_DEVICE  thePort  ) 

Stores the port of the graphics device internally.

Parameters:
thePort The drawing port of the graphics device.
void VisualGraphics::setLineWidth ( double  width  ) 

Sets the line width for subsequent line drawing operations.

Parameters:
width The requested width for subsequent line drawing operations.
void VisualGraphics::setOrthographicProjection ( double  maxLeftCoord,
double  maxRightCoord,
double  maxBottomCoord,
double  maxTopCoord,
double  maxNearPos,
double  maxFarPos,
double  zoomFactor = 1.0 
)

Sets up an orthographic projection mode.

Parameters:
maxLeftCoord Maximum left coord position.
maxRightCoord Maximum right coord position.
maxBottomCoord Maximum bottom coord position.
maxTopCoord Maximum top coord position.
maxNearPos Maximum near position (position of near clipping plane).
maxFarPos Maximum far position (position of far clipping plane).
zoomFactor Optional zoom factor.
void VisualGraphics::setPerspectiveProjection ( double  maxLeftCoord,
double  maxRightCoord,
double  maxBottomCoord,
double  maxTopCoord,
double  maxNearPos,
double  maxFarPos,
double  zoomFactor = 1.0 
)

Sets up a perspective projection mode.

Parameters:
maxLeftCoord Maximum left coord position.
maxRightCoord Maximum right coord position.
maxBottomCoord Maximum bottom coord position.
maxTopCoord Maximum top coord position.
maxNearPos Maximum near position (position of near clipping plane).
maxFarPos Maximum far position (position of far clipping plane).
zoomFactor Optional zoom factor.
void VisualGraphics::setPixelStorageParams ( void   ) 

Specifies the storage parameters for pixel packing and unpacking (copying from GPU to CPU and vice versa).

void VisualGraphics::setSurfaceViewport ( void   ) 

Sets up the viewport according to current dimensions of surface rect.

void VisualGraphics::setTotalVisualizerRect ( TopLeftPositionedPixelRect  aRect  ) 

Sets the dimensions of the total visualizer rect.

Parameters:
aRect The dimensions and position of the total visualizer rect.
void VisualGraphics::setTotalVisualizerRectVerticalOffsetFromBottom ( int  top,
int  height 
)

Stores the vertical offset of the surface rect from the bottom of the iTunes window.

Parameters:
top The top pixel position of the total visualizer rect.
height The height of the total visualizer rect.
bool VisualGraphics::setupContext (  ) 

Sets up an OpenGL context of the operating system. OS windowing system and OpenGL get connected.

Returns:
true on success, false on failure.
void VisualGraphics::showProcessInfoNote ( void   ) 

Shows a note about Process Monitor.

void VisualGraphics::showProcessInfoRow ( Coord  coord,
const char *const   textRowStr 
)

Shows a row of Process Monitor Info. The graphical operations involved in putting a row of textual process info on screen is encapsulated within this function.

Parameters:
coord The coord where to place the text (left start position).
textRowStr Pointer to character buffer with process info string (label and value).
void VisualGraphics::spotGL ( double  zPlane = 0.0  ) 

Draws a spot (for testing purpose).

Parameters:
zPlane The z-Coord (optional parameter, default = 0.0).
void VisualGraphics::translateMatrix ( double  xNum,
double  yNum,
double  zNum 
)

Call of glTranslate().

Parameters:
xNum Horizontal coord value.
yNum Vertical coord value.
zNum Z-coord value.
uint16 VisualGraphics::xCoordToPixel ( double  coordPos,
const VisualCamera aCamera 
)

Converts a horizontal coordinate to a horizontal pixel position.

Parameters:
coordPos The canvas coord position.
Returns:
The canvas pixel position.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
double VisualGraphics::xPixelToCoord ( uint32  pixelPos,
const VisualCamera aCamera 
)

Converts a horizontal pixel position to a horizontal coordinate.

Parameters:
pixelPos The canvas pixel position.
Returns:
The canvas coord position.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
uint16 VisualGraphics::yCoordToPixel ( double  coordPos,
const VisualCamera aCamera 
)

Converts a vertical coordinate to a horizontal pixel position.

Parameters:
coordPos The canvas coord position.
Returns:
The canvas pixel position.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.
double VisualGraphics::yPixelToCoord ( uint32  pixelPos,
const VisualCamera aCamera 
)

Converts a vertical pixel position to a vertical coordinate.

Parameters:
pixelPos The canvas pixel position.
Returns:
The canvas coord position.
Parameters:
aCamera Camera with dimensions, position, perspective projection, and orientation of stage view.

Member Data Documentation

The color of the canvas background.

The rectangle where the drawing takes place.

The capabilities.

True if set up on full screen, false if set up in windowed mode.

The nurbsMap is the map of the VisualNurbs.

The color of the surface background.

The dimensions of the complete drawing surface which is reserved for visualizer action.

The vertical offset of the bottom-positioned surface rect.

VisualGraphics is a singleton class. Pointer to private instance is handled internally.


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

Generated on Sun Sep 26 2010 13:29:36 for VizKit by doxygen 1.7.1