VizKit  3.3.7
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
VizKit::VisualGraphics Class Reference

Communicates with the graphics device. More...

#include <VisualGraphics.h>

List of all members.

Classes

struct  GLCapabilities
 A struct containing OpenGL capabilities. More...

Public Member Functions

void setPlatformView (VISUAL_PLATFORM_VIEW aView)
 Keeps a reference to the platform specific view for internal use.
const VISUAL_PLATFORM_VIEW getPlatformView (void)
 Returns the platform specific view for rendering.
void refreshCanvasRect ()
 Refreshes the draw rect according to current VISUAL_PLATFORM_VIEW.
void isSetupForFullScreenMode (const bool isFullscreen)
 Stores whether the visualizer is expected to show in fullscreen mode or in windowed mode.
PixelRect getCanvasRect (void)
 Returns the dimensions of the canvas.
size_t getCanvasPixelWidth (void)
 Returns the width of the canvas in pixels.
size_t getCanvasPixelHeight (void)
 Returns the height of the canvas in pixels.
float getScreenScaleFactor ()
 Returns the screen scale factor.
BottomLeftPositionedPixelRect getViewportRect (void)
 Returns the dimensions and position of the current OpenGL viewport.
Pixel getViewportBottomLeftOrigin (void)
 Returns the bottom-left positioned origin of the viewport rect.
RelationalRect getViewportOrientationAndAspectRatio (void)
 Returns the current orientation and aspect ratio of the viewport.
bool setupContext ()
 Sets up an OpenGL context of the operating system.
void disposeContext (void)
 Tears down the OpenGL allocations.
void setCanvasViewport (void)
 Sets up the viewport according to current dimensions of canvasRect.
void setOrthographicProjection (double maxLeftCoord, double maxRightCoord, double maxBottomCoord, double maxTopCoord, double maxNearPos, double maxFarPos, double zoomFactor=1.0)
 Sets up an orthographic projection mode.
void setPerspectiveProjection (double maxLeftCoord, double maxRightCoord, double maxBottomCoord, double maxTopCoord, double maxNearPos, double maxFarPos, double zoomFactor=1.0)
 Sets up a perspective projection mode.
void setClippingRect (BottomLeftPositionedPixelRect aRect)
 Sets a clipping rect.
void disableClipping (void)
 Disables clipping.
void loadModelViewIdentityMatrix (void)
 Loads the identity matrix of the model view.
void lookAt (Point3D eye, Point3D center, Vector up)
 Performs a viewing transformation.
void setCanvasBackgroundColor (const RGBAColor &aColorVal)
 Sets the value of the canvas background color.
RGBAColor getBackgroundColor (void)
 Returns the value of the canvas background color.
void clearCanvasBackground (void)
 Clears the canvas region with the background color.
void setPixelStorageParams (void)
 Specifies the storage parameters for pixel packing and unpacking (copying from GPU to CPU and vice versa).
void resetModelViewMatrix (void)
 Resets the model view matrix.
void translateMatrix (double xNum, double yNum, double zNum)
 Call of glTranslate().
void rotateMatrix (double angle, double xAmount, double yAmount, double zAmount)
 Call of glRotate().
void scaleMatrix (double xFactor, double yFactor, double zFactor)
 Call of glScale().
void enableTexturing (bool useRectExtension)
 Enables texturing by calling glEnable(GL_TEXTURE_2D) or glEnable(GL_TEXTURE_RECTANGLE_EXT).
void disableTexturing (bool useRectExtension)
 Disables texturing by calling glDisable(GL_TEXTURE_2D) or glDisable(GL_TEXTURE_RECTANGLE_EXT).
void bindTexture (uint32 textureName, bool useRectExtension)
 Binds a texture (sets it current) by calling glBindTexture().
void getPixelsOfCurrentTexture (bool useRectExtension, uint16 format, uint16 type, uint32 **buffer)
 Writes the pixels of the current texture (last one binded) into the provided buffer.
void enableAlphaBlending (void)
 Enables blending by calling glEnable(GL_BLEND) followed by function glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
void disableBlending (void)
 Disables blending by calling glDisable(GL_BLEND).
void setColor (const RGBAColor &theColor)
 Sets a color value by calling glColor().
void setLineWidth (double width)
 Sets the line width for subsequent line drawing operations.
void enableDepthTest (void)
 Enables GL_DEPTH_TEST.
void disableDepthTest (void)
 Disables GL_DEPTH_TEST.
void enableCullFace (void)
 Enables GL_CULL_FACE.
void disableCullFace (void)
 Disables GL_CULL_FACE.
void cullFaceFront (void)
 Specifies that front-facing facets can be culled.
void cullFaceBack (void)
 Specifies that back-facing facets can be culled.
uint8 getOpenGLError (char *outErrorString)
 Returns an error string (if there was an error).
uint16 setCurrentContext (void)
 Sets the current context to the one that has been set up before with the setupContext() call.
void finishGLDrawing (void)
 Ends the GL drawing by flushing, finishing and swaping the buffer content.
int getCurrentColorBufferForPixelReadingOperations (void)
 Returns the current color buffer specification for reading pixels.
int getCurrentColorBufferForPixelDrawingOperations (void)
 Returns the current color buffer specification for drawing pixels.
void setColorBufferForPixelReadingOperations (int colorBuffer)
 Sets the color buffer specification for reading pixels.
void setColorBufferForPixelDrawingOperations (int colorBuffer)
 Sets the color buffer specification for drawing pixels.
void drawTexture (uint32 textureNumber, const VertexChain *const vertexChain, bool canUseRectExtension, BlendMode aBlendMode=kBlend, bool debug=false)
 Draws a texture on screen.
void drawVertexChain (const VertexChain &vertexChain, int drawMode=kGL_LINE_LOOP, BlendMode aBlendMode=kReplace)
 Draws a vertex chain.
void drawDebugVertexChain (const VertexChain &vertexChain, const VisualCamera &aCamera)
 Draws debug information of a vertex chain.
void drawPixels (PixelColor **pixelData, double xCoord, double yCoord, size_t width, size_t height, uint16 format, uint16 dataType, const VisualConvolutionFilter *const aConvolutionFilter=NULL)
 Draws image data to framebuffer.
void resample (uint16 formatIn, size_t widthIn, size_t heightIn, uint16 dataTypeIn, PixelColor *pixelDataIn, uint32 widthOut, uint32 heightOut, uint16 dataTypeOut, PixelColor **pixelDataOut)
 Resamples (resizes) pixel data according to the passed-in dimensions.
void readPixels (double xCoord, double yCoord, size_t width, size_t height, uint32 **pixelData, uint16 format, uint16 dataType, const VisualCamera &aCamera)
 Reads image data from framebuffer into processor memory.
void 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.
void drawTriangle (void)
 Draws a triangle.
void spotGL (double zPlane=0.0)
 Draws a spot (for testing purpose).
void drawProjectionMetrics (const VisualCamera &aCamera)
 Draws some metrics in the current scene.
Coord getCirclePoint (uint32 sliceIdx, uint32 slicesCount, double radius=1.0, Coord circleCenter=zeroCoord)
 Returns a point on the outline of a circle.
void drawBeatHistogram (const uint32 *const beatHistogram, const VisualCamera &aCamera)
 Draws a histogram of the beat values.
bool canUseTextureRectExtension (void)
 The function queries the system and answers whether textures can have non power of 2 dimensions.
bool doesSupportGLConvolutionFilter (void)
 The function queries the system and answers whether convolution filter can be performed with OpenGL system.
void drawWaveform (const sint16 historyNum, const uint16 maxNumberOfHistories, const uint32 numberOfWaveformEntries, sint16 **waveformDataMonoArray, const VisualCamera &aCamera)
 Draws the waveform data.
void drawWaveformSpiral (const uint16 currHistoryNum, const uint16 numberOfWaveformEntries, const sint16 *const waveformDataMonoArray)
 Draws the waveform data in spiral form.
void 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.
void 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.
void drawWaveformCircle (const float xNum, const float yNum, const float rotVal, const float radius)
 Draws a circle representing the waveform data.
void drawCStringWithGL (const char *const cString, const uint16 stringLength)
 Draws a 7bit char buffer string to screen.
void doFallbackActorShow (const char *const visualActorName)
 The default implementation of the show() method of the VisualActor interface class.
float getCosTwoTimesPi (void)
 Returns cos(2.0 * _PI).
float getSinTwoTimesPi (void)
 Returns sin(2.0 * _PI).
uint32 getNextFreeTextureName (void)
 Returns a free texture name/index/number/id.
void deleteTextures (const uint16 numberOfTextures, const uint32 *const textureNames)
 Frees memory bound by OpenGL textures.
void showProcessInfoRow (Coord coord, const char *const textRowStr)
 Shows a row of Process Monitor Info.
void showProcessInfoNote (void)
 Shows a note about Process Monitor.
PixelColorclipPixelData (const PixelColor *inPixelData, const PixelRect &inPixelRect, const TopLeftPositionedPixelRect &clipRect)
 Creates clipped pixel data.
bool copyARGBBitmapDataToTexture (uint32 textureNumber, size_t imageWidth, size_t imageHeight, bool canUseRectExtension, const PixelColor **bitmapData, bool debug=false)
 Copies ARGB bitmap data into texture.
const char *const getRendererName (void)
 Returns the name of the renderer of the graphic card.
const char *const getRendererVendor (void)
 Returns the name of the vendor of the graphic card.
const char *const getRendererVersion (void)
 Returns the version of the renderer.
unsigned short getGLVersion (void)
 Returns the version of OpenGL.
long getMaxTextureSize (void)
 Returns the maximum texture size.
double xPixelToCoord (double pixelPos, const VisualCamera &aCamera)
 Converts a horizontal pixel position to a horizontal coordinate.
double yPixelToCoord (double pixelPos, const VisualCamera &aCamera)
 Converts a vertical pixel position to a vertical coordinate.
uint16 xCoordToPixel (double coordPos, const VisualCamera &aCamera)
 Converts a horizontal coordinate to a horizontal pixel position.
uint16 yCoordToPixel (double coordPos, const VisualCamera &aCamera)
 Converts a vertical coordinate to a horizontal pixel position.
bool getCoordsOfPixelPosition (double xPixelPos, double yPixelPos, double zAxisPos, double *xCoordPos, double *yCoordPos, double *zCoordPos)
 Maps window coordinates to object coordinates.
bool getPixelsOfCoordPosition (double xCoordPos, double yCoordPos, double zCoordPos, double *xPixelPos, double *yPixelPos, double *zAxisPos)
 Maps object coordinates to window coordinates.
void gatherOpenGLCapabilities (void)
 Determines the openGL capabilities and stores them internally.
VisualNurbscreateNurbsObject (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.
void deleteNurbsObject (const VisualItemIdentifier &identifier)
 Deletes a NURBS object.
VisualNurbsgetNurbsObject (const VisualItemIdentifier &identifier)
 Returns a pointer to a NURBS object.
void copyFramebufferToTexture (uint32 textureNumber, bool canUseRectExtension, const BottomLeftPositionedPixelRect &clipRect, uint16 pixelFormat, uint16 dataType)
 Copies the content of a screen rectangle into a texture buffer.
uint32 power2Ceiling (uint32 n)
 Returns the nearest power of 2 integer following the input integer.

Static Public Member Functions

static VisualGraphicsgetInstance (void)
 Returns a pointer to the instance.
static void dispose (void)
 Cleans up the Visual Graphics singleton class.
static bool isInitialized (void)
 Answers the question whether the Visual Graphics singleton class is initialized or not.
static void drawHistoryDiagram (std::vector< double > &aVector, size_t baseIdx, double minVal, double maxVal, const VisualCamera &aCamera)
 Draws the data of a vector.

Private Types

typedef std::map
< VisualItemIdentifier,
VisualNurbs * > 
NurbsMap
 A NurbsMap is a map of an identifier string and a pointer to a VisualNurbs.
typedef NurbsMap::iterator NurbsMapIterator
 A NurbsMapIterator is an iterator of a NurbsMap.

Private Member Functions

 VisualGraphics ()
 Writes ARGB pixel bitmap data into provided buffer.
 ~VisualGraphics ()
 The destructor.
 VisualGraphics (const VisualGraphics &other)
 Copy constructor.
VisualGraphicsoperator= (const VisualGraphics &other)
 Assignment operator.

Private Attributes

bool isSetUpOnFullscreen
 True if set up on full screen, false if set up in windowed mode.
RGBAColor canvasBackgroundColor
 The color of the canvas background.
GLCapabilities capabilities
 The capabilities.
NurbsMap nurbsMap
 The nurbsMap is the map of the VisualNurbs.

Static Private Attributes

static VisualGraphicstheVisualGraphics = NULL
 VisualGraphics is a singleton class.

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

Writes ARGB pixel bitmap data into provided buffer.

Parameters:
stringValueThe string value that should be converted into a texture.
bitmapWidthThe width of the bitmap (in pixels). The size of the bitmap can be different from the exact size of the string so that it may fit for a power-of-2 texture.
bitmapHeightThe height of the bitmap (in pixels). The size of the bitmap can be different from the exact size of the string so that it may fit for a power-of-2 texture.
fontNameStrThe name of the font.
fontSizeThe font size.
redThe red color component of the text font.
greenThe green color component of the text font.
blueThe blue color component of the text font.
maxPixelWidthThe requested maximum width of the texture. If 0 the argument is ignored.
maxPixelHeightThe requested maximum height of the texture. If 0 the argument is ignored.
alignmentThe horizontal alignment of the string. Possible values: left, center, right.
[out]bitmapOutPointer to pointer to the buffer into which the pixel bitmap data is written.
Remarks:
The bitmapOut buffer is assumed to have allocated sufficient memory. To access the function with CFBundleGetFunctionPointerForName() the visibility is set to default. The constructor. VisualGraphics is a singleton class. The constructor is private. New instance of class can only be created internally.

The destructor.

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

Copy constructor.

Parameters:
otherAnother 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:
textureNameThe name/number/id of the texture.
useRectExtensionIf true texture is bound with GL_TEXTURE_RECTANGLE_EXT, if false texture is bound with GL_TEXTURE_2D.

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.

Clears the canvas region with the background color.

PixelColor * VisualGraphics::clipPixelData ( const PixelColor inPixelData,
const PixelRect inPixelRect,
const TopLeftPositionedPixelRect clipRect 
)

Creates clipped pixel data.

Parameters:
inPixelDataPixel data to be clipped.
inPixelRectDimensions of pixel data.
clipRectDimensions 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,
size_t  imageWidth,
size_t  imageHeight,
bool  canUseRectExtension,
const PixelColor **  bitmapData,
bool  debug = false 
)

Copies ARGB bitmap data into texture.

Parameters:
textureNumberThe texture number (texture name) of the generated texture.
imageWidthThe width of the bitmap data (width of texture might differ because of normalization to power-of-two value).
imageHeightThe height of the bitmap data (height of texture might differ because of normalization to power-of-two value).
canUseRectExtensionTrue if the texture does support rectangular texture extension. False otherwise.
bitmapDataPointer to pointer to the bitmap data.
debugIf 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:
textureNumberThe number/id/name of the texture.
canUseRectExtensionTrue if graphics system does support rectangular texture extension. False otherwise. Default false.
clipRectThe dimensions and position of the clip rect.
pixelFormatThe format of the pixels (kGL_RGBA, kGL_LUMINANCE).
dataTypeThe 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:
identifierIdentifier of the NURBS. The Nurbs can later be addressed by that token.
sNumKnotsThe number of knots in horizontal direction.
sKnotsAn array of horizontal knot values.
tNumKnotsThe number of knots in vertical direction.
tKnotsAn array of vertical knot values.
sStrideThe offset between successive control points in u direction.
tStrideThe offset between successive control points in v direction.
sOrderThe order of the NURBS surface in u direction.
tOrderThe order of the NURBS surface in v direction.
Returns:
The newly created NURBS object with the identifierName.

Specifies that back-facing facets can be culled.

Specifies that front-facing facets can be culled.

Deletes a NURBS object.

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

Frees memory bound by OpenGL textures.

Parameters:
numberOfTexturesThe number of textures to free.
textureNamesPointer to texture names (texture numbers) to free.

Disables blending by calling glDisable(GL_BLEND).

Disables clipping.

Remarks:
Disables GL_SCISSOR_TEST.

Disables GL_CULL_FACE.

Disables GL_DEPTH_TEST.

void VisualGraphics::disableTexturing ( bool  useRectExtension)

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

Parameters:
useRectExtensionIf 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.

Tears down the OpenGL allocations.

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:
visualActorNameThe name of the VisualActor.
void VisualGraphics::drawBeatHistogram ( const uint32 *const  beatHistogram,
const VisualCamera aCamera 
)

Draws a histogram of the beat values.

Parameters:
beatHistogramThe beat histogram.
aCameraCamera 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:
vertexChainA vector of vertices.
aCameraCamera 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:
aVectorReference to a vextor that holds the data.
baseIdxThe current start index.
minValThe (possible) minumum value. The value is used for calculating the vertical dimension of the diagram.
maxValThe (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:
aCameraCamera with dimensions, position, perspective projection, and orientation of stage view.
void VisualGraphics::drawPixels ( PixelColor **  pixelData,
double  xCoord,
double  yCoord,
size_t  width,
size_t  height,
uint16  format,
uint16  dataType,
const VisualConvolutionFilter *const  aConvolutionFilter = NULL 
)

Draws image data to framebuffer.

Parameters:
pixelDataPointer to pointer to image data.
xCoordThe bottom left x coord.
yCoordThe bottom top y coord.
widthThe width of the rectangle.
heightThe height of the rectangle.
formatThe format of the pixels (kGL_RGBA, kGL_LUMINANCE).
dataTypeThe data type of the pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
aConvolutionFilterAn optional convolution filter that is used when drawing the pixels.

Draws some metrics in the current scene.

Remarks:
For diagnostical puposes.
Parameters:
aCameraCamera 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:
currHistoryNumThe index of the history the spectrum data is taken from.
numberOfHistoriesThe maximum number of histories.
numberOfSpectrumEntriesThe number of spectrum data values.
numberOfAudioChannelsThe number of audio channels.
spectrumDataArrayPointer to spectrum data of all histories.
aCameraCamera 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:
currHistoryNumThe index of the history the spectrum data is taken from.
numberOfHistoriesThe maximum number of histories.
numberOfSpectrumEntriesThe number of spectrum data values.
numberOfAudioChannelsThe number of audio channels.
spectrumDataArrayPointer to spectrum data of all histories.
aCameraCamera 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:
xNumThe horizontal position of the spot.
yNumThe vertical position of the spot.
rThe red component of the RGB-Color.
gThe green component of the RGB-Color.
bThe blue component of the RGB-Color.
waveformIntensityValThe current radius of the spot.
intensityThe current intensity of the spot.
tailSizeThe 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:
textureNumberThe number/id/name of the texture.
vertexChainA vector of vertices.
canUseRectExtensionTrue if graphics system does support rectangular texture extension. False otherwise.
aBlendModeHow to blend texture data with the framebuffer data. Default kBlend.
debugIf true the position numbers are displayed.

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:
vertexChainA vector of vertices.
drawModeThe 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).
aBlendModeHow 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:
historyNumThe index of the history the waveform data is taken from.
maxNumberOfHistoriesMaximum number of histories stored in waveformDataMonoArray.
numberOfWaveformEntriesThe number of waveform values.
waveformDataMonoArrayPointer to waveform data of all histories. The array has two dimensions: history and index.
aCameraCamera 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:
xNumThe horizontal position.
yNumThe vertical position.
rotValThe degree of rotation.
radiusRadius.
void VisualGraphics::drawWaveformSpiral ( const uint16  currHistoryNum,
const uint16  numberOfWaveformEntries,
const sint16 *const  waveformDataMonoArray 
)

Draws the waveform data in spiral form.

Parameters:
currHistoryNumThe current history of the waveform data.
numberOfWaveformEntriesThe number of waveform values.
waveformDataMonoArrayPointer to waveform data of all histories.

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.

Enables GL_CULL_FACE.

Enables GL_DEPTH_TEST.

void VisualGraphics::enableTexturing ( bool  useRectExtension)

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

Parameters:
useRectExtensionIf true texturing is enabled with GL_TEXTURE_RECTANGLE_EXT, if false texturing is enabled with GL_TEXTURE_2D.

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.

Determines the openGL capabilities and stores them internally.

Returns the value of the canvas background color.

Returns:
The RGBA values of the canvas background color.

Returns the height of the canvas in pixels.

Returns:
The height of the canvas in pixels.

Returns the width of the canvas in pixels.

Returns:
The width of the canvas in pixels.

Returns the dimensions of the canvas.

Returns:
The dimensions of the canvas.
Coord VisualGraphics::getCirclePoint ( uint32  sliceIdx,
uint32  slicesCount,
double  radius = 1.0,
Coord  circleCenter = zeroCoord 
)

Returns a point on the outline of a circle.

Parameters:
sliceIdxThe index of the requested slice.
slicesCountThe number of slices.
radiusThe length of the radius. Default = 1.0.
circleCenterThe 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:
xPixelPosThe horizontal pixel position.
yPixelPosThe vertical pixel position.
zAxisPosThe position on the z-axis. 0: near clipping plane, 1: far clipping plane.
xCoordPosReturns: The x-CoordPosition.
yCoordPosReturns: The y-CoordPosition.
zCoordPosReturns: The z-CoordPosition.
Returns:
True on success, false on error.

Returns cos(2.0 * _PI).

Returns:
cos(2.0 * _PI).

Returns the current color buffer specification for drawing pixels.

Returns:
The current color buffer specification for drawing pixels.

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.

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.

Returns the maximum texture size.

Returns:
the maximum texture size.

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

Returns:
A free texture name/index/number.

Returns a pointer to a NURBS object.

Parameters:
identifierThe 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]outErrorStringPointer 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:
xCoordPosThe x-CoordPosition.
yCoordPosThe y-CoordPosition.
zCoordPosThe z-CoordPosition.
xPixelPosReturns: The horizontal pixel position.
yPixelPosReturns: The vertical pixel position.
zAxisPosReturns: 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:
useRectExtensionIf true texture has rectangular dimensions.
formatThe format of the pixels (kGL_RGBA, kGL_LUMINANCE).
typeThe data type of the pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
[out]bufferPointer to pointer to allocated buffer of 32bit chunks (one chunk is one pixel with four 8bit channels).

Returns the platform specific view for rendering.

Returns:
The platform specific view for rendering.
Remarks:
On Mac VISUAL_PLATFORM_VIEW is defined as NSView*, on Windows it is defined as HWND.
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.

Returns the screen scale factor.

Retina displays on the Mac have a screen scale factor of 2.0.

Returns sin(2.0 * _PI).

Returns:
sin(2.0 * _PI).

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

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

Returns the current orientation and aspect ratio of the viewport.

Returns:
The current orientation and aspect ratio of the viewport.

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:
isFullscreenTrue if fullscreen mode is expected. False if windowed mode is expected.

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:
eyeThe position of the eye point.
centerThe position of the reference point.
upthe 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.

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

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

Reads image data from framebuffer into processor memory.

Parameters:
xCoordThe bottom left x coord.
yCoordThe bottom top y coord.
widthThe width of the rectangle.
heightThe height of the rectangle.
[out]pixelDataPointer to pointer of buffer to write image data to.
formatThe format of the requested pixels (kGL_RGBA, kGL_LUMINANCE).
dataTypeThe data type of the requested pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
aCameraCamera with dimensions, position, perspective projection, and orientation of stage view.

Refreshes the draw rect according to current VISUAL_PLATFORM_VIEW.

void VisualGraphics::resample ( uint16  formatIn,
size_t  widthIn,
size_t  heightIn,
uint16  dataTypeIn,
PixelColor pixelDataIn,
uint32  widthOut,
uint32  heightOut,
uint16  dataTypeOut,
PixelColor **  pixelDataOut 
)

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

Parameters:
formatInThe format of the incoming pixels (kGL_RGBA, kGL_LUMINANCE).
widthInThe width of the incoming pixels.
heightInThe width of the incoming pixels.
dataTypeInThe data type of the incoming pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
pixelDataInA pointer to the incoming pixel data.
widthOutThe requested width of the outgoing pixels.
heightOutThe requested height of the outgoing pixels.
dataTypeOutThe requested data type of the outgoing pixels (kGL_UNSIGNED_BYTE, kGL_FLOAT).
pixelDataOutA pointer to a pointer to the outgoing pixel data. The memory has to be allocated an freed by the caller.

Resets the model view matrix.

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

Call of glRotate().

Parameters:
angleThe angle of the rotation.
xAmountThe amount of the rotation around the horizontal axis.
yAmountThe amount of the rotation around the vertical axis.
zAmountThe amount of the rotation around the z-axis.
void VisualGraphics::scaleMatrix ( double  xFactor,
double  yFactor,
double  zFactor 
)

Call of glScale().

Parameters:
xFactorThe scale factor in the horizontal dimension.
yFactorThe scale factor in the vertical dimension.
zFactorThe scale factor in the z-dimension.

Sets the value of the canvas background color.

Parameters:
aColorValThe RGBA values.

Sets up the viewport according to current dimensions of canvasRect.

Sets a clipping rect.

Parameters:
aRectRect to use as clipping rect.
Remarks:
A clipping rect is set by means of glScissor() function. GL_SCISSOR_TEST is enabled here, too.
void VisualGraphics::setColor ( const RGBAColor theColor)

Sets a color value by calling glColor().

Parameters:
theColorThe color values to set.

Sets the color buffer specification for drawing pixels.

Parameters:
colorBufferThe color buffer to use for drawing pixels.

Sets the color buffer specification for reading pixels.

Parameters:
colorBufferThe color buffer to use for reading pixels.

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::setLineWidth ( double  width)

Sets the line width for subsequent line drawing operations.

Parameters:
widthThe 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:
maxLeftCoordMaximum left coord position.
maxRightCoordMaximum right coord position.
maxBottomCoordMaximum bottom coord position.
maxTopCoordMaximum top coord position.
maxNearPosMaximum near position (position of near clipping plane).
maxFarPosMaximum far position (position of far clipping plane).
zoomFactorOptional 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:
maxLeftCoordMaximum left coord position.
maxRightCoordMaximum right coord position.
maxBottomCoordMaximum bottom coord position.
maxTopCoordMaximum top coord position.
maxNearPosMaximum near position (position of near clipping plane).
maxFarPosMaximum far position (position of far clipping plane).
zoomFactorOptional zoom factor.

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

Keeps a reference to the platform specific view for internal use.

Parameters:
aViewA platform specific view.
Remarks:
On Mac VISUAL_PLATFORM_VIEW is defined as NSView*, on Windows it is defined as HWND.

Sets up an OpenGL context of the operating system.

OS windowing system and OpenGL get connected.

Returns:
true on success, false on failure.

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:
coordThe coord where to place the text (left start position).
textRowStrPointer to character buffer with process info string (label and value).
void VisualGraphics::spotGL ( double  zPlane = 0.0)

Draws a spot (for testing purpose).

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

Call of glTranslate().

Parameters:
xNumHorizontal coord value.
yNumVertical coord value.
zNumZ-coord value.
uint16 VisualGraphics::xCoordToPixel ( double  coordPos,
const VisualCamera aCamera 
)

Converts a horizontal coordinate to a horizontal pixel position.

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

Converts a horizontal pixel position to a horizontal coordinate.

Parameters:
pixelPosThe canvas pixel position.
Returns:
The canvas coord position.
Parameters:
aCameraCamera 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:
coordPosThe canvas coord position.
Returns:
The canvas pixel position.
Parameters:
aCameraCamera with dimensions, position, perspective projection, and orientation of stage view.
double VisualGraphics::yPixelToCoord ( double  pixelPos,
const VisualCamera aCamera 
)

Converts a vertical pixel position to a vertical coordinate.

Parameters:
pixelPosThe canvas pixel position.
Returns:
The canvas coord position.
Parameters:
aCameraCamera with dimensions, position, perspective projection, and orientation of stage view.

Member Data Documentation

The color of the canvas background.

The capabilities.

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

The nurbsMap is the map of the VisualNurbs.

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 May 3 2015 20:26:32 for VizKit by doxygen 1.8.0