VizKit
3.3.7
|
Communicates with the graphics device. More...
#include <VisualGraphics.h>
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. | |
PixelColor * | clipPixelData (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. | |
VisualNurbs * | 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. | |
void | deleteNurbsObject (const VisualItemIdentifier &identifier) |
Deletes a NURBS object. | |
VisualNurbs * | getNurbsObject (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 VisualGraphics * | getInstance (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. | |
VisualGraphics & | operator= (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 VisualGraphics * | theVisualGraphics = NULL |
VisualGraphics is a singleton class. |
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.
typedef std::map<VisualItemIdentifier, VisualNurbs*> VizKit::VisualGraphics::NurbsMap [private] |
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.
VisualGraphics::VisualGraphics | ( | ) | [private] |
Writes ARGB pixel bitmap data into provided buffer.
stringValue | The string value that should be converted into a texture. | |
bitmapWidth | The 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. | |
bitmapHeight | The 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. | |
fontNameStr | The name of the font. | |
fontSize | The font size. | |
red | The red color component of the text font. | |
green | The green color component of the text font. | |
blue | The blue color component of the text font. | |
maxPixelWidth | The requested maximum width of the texture. If 0 the argument is ignored. | |
maxPixelHeight | The requested maximum height of the texture. If 0 the argument is ignored. | |
alignment | The horizontal alignment of the string. Possible values: left, center, right. | |
[out] | bitmapOut | Pointer to pointer to the buffer into which the pixel bitmap data is written. |
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.
other | Another VisualGraphics. |
void VisualGraphics::bindTexture | ( | uint32 | textureName, |
bool | useRectExtension | ||
) |
Binds a texture (sets it current) by calling glBindTexture().
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.
void VisualGraphics::clearCanvasBackground | ( | void | ) |
Clears the canvas region with the background color.
PixelColor * VisualGraphics::clipPixelData | ( | const PixelColor * | inPixelData, |
const PixelRect & | inPixelRect, | ||
const TopLeftPositionedPixelRect & | clipRect | ||
) |
Creates clipped pixel data.
inPixelData | Pixel data to be clipped. |
inPixelRect | Dimensions of pixel data. |
clipRect | Dimensions of the clip rect. |
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.
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. |
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.
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). |
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.
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. |
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.
identifier | The identifier of the NURBS. |
void VisualGraphics::deleteTextures | ( | const uint16 | numberOfTextures, |
const uint32 *const | textureNames | ||
) |
Frees memory bound by OpenGL textures.
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::disableClipping | ( | void | ) |
Disables clipping.
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).
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.
void VisualGraphics::doFallbackActorShow | ( | const char *const | visualActorName | ) |
The default implementation of the show() method of the VisualActor interface class.
visualActorName | The name of the VisualActor. |
void VisualGraphics::drawBeatHistogram | ( | const uint32 *const | beatHistogram, |
const VisualCamera & | aCamera | ||
) |
Draws a histogram of the beat values.
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.
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.
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. |
aCamera | Camera 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
Returns the value of the canvas background color.
size_t VisualGraphics::getCanvasPixelHeight | ( | void | ) |
Returns the height of the canvas in pixels.
size_t VisualGraphics::getCanvasPixelWidth | ( | void | ) |
Returns the width of the canvas in pixels.
PixelRect VisualGraphics::getCanvasRect | ( | void | ) |
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.
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. |
bool VisualGraphics::getCoordsOfPixelPosition | ( | double | xPixelPos, |
double | yPixelPos, | ||
double | zAxisPos, | ||
double * | xCoordPos, | ||
double * | yCoordPos, | ||
double * | zCoordPos | ||
) |
Maps window coordinates to object coordinates.
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. |
float VisualGraphics::getCosTwoTimesPi | ( | void | ) |
Returns cos(2.0 * _PI).
Returns the current color buffer specification for drawing pixels.
Returns the current color buffer specification for reading pixels.
unsigned short VisualGraphics::getGLVersion | ( | void | ) |
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.
long VisualGraphics::getMaxTextureSize | ( | void | ) |
Returns the maximum texture size.
Returns a free texture name/index/number/id.
VisualNurbs * VisualGraphics::getNurbsObject | ( | const VisualItemIdentifier & | identifier | ) |
Returns a pointer to a NURBS object.
identifier | The identifier of the NURBS. |
uint8 VisualGraphics::getOpenGLError | ( | char * | outErrorString | ) |
Returns an error string (if there was an error).
[out] | outErrorString | Pointer to character buffer to receive the error string. |
bool VisualGraphics::getPixelsOfCoordPosition | ( | double | xCoordPos, |
double | yCoordPos, | ||
double | zCoordPos, | ||
double * | xPixelPos, | ||
double * | yPixelPos, | ||
double * | zAxisPos | ||
) |
Maps object coordinates to window coordinates.
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. |
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.
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). |
const VISUAL_PLATFORM_VIEW VisualGraphics::getPlatformView | ( | void | ) |
Returns the platform specific view for rendering.
const char *const VisualGraphics::getRendererName | ( | void | ) |
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.
const char *const VisualGraphics::getRendererVersion | ( | void | ) |
Returns the version of the renderer.
float VisualGraphics::getScreenScaleFactor | ( | ) |
Returns the screen scale factor.
Retina displays on the Mac have a screen scale factor of 2.0.
float VisualGraphics::getSinTwoTimesPi | ( | void | ) |
Returns sin(2.0 * _PI).
Returns the bottom-left positioned origin of the viewport rect.
Returns the current orientation and aspect ratio of the 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.
void VisualGraphics::isSetupForFullScreenMode | ( | const bool | isFullscreen | ) |
Stores whether the visualizer is expected to show in fullscreen mode or in windowed mode.
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
void VisualGraphics::lookAt | ( | Point3D | eye, |
Point3D | center, | ||
Vector | up | ||
) |
Performs a viewing transformation.
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.
Returns the nearest power of 2 integer following the input integer.
n | The input 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.
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::refreshCanvasRect | ( | ) |
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.
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().
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().
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.
aColorVal | The RGBA values. |
void VisualGraphics::setCanvasViewport | ( | void | ) |
Sets up the viewport according to current dimensions of canvasRect.
void VisualGraphics::setClippingRect | ( | BottomLeftPositionedPixelRect | aRect | ) |
Sets a clipping rect.
aRect | Rect to use as clipping rect. |
void VisualGraphics::setColor | ( | const RGBAColor & | theColor | ) |
Sets a color value by calling glColor().
theColor | The color values to set. |
void VisualGraphics::setColorBufferForPixelDrawingOperations | ( | int | colorBuffer | ) |
Sets the color buffer specification for drawing pixels.
colorBuffer | The color buffer to use for drawing pixels. |
void VisualGraphics::setColorBufferForPixelReadingOperations | ( | int | colorBuffer | ) |
Sets the color buffer specification for reading pixels.
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.
void VisualGraphics::setLineWidth | ( | double | width | ) |
Sets the line width for subsequent line drawing operations.
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.
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.
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::setPlatformView | ( | VISUAL_PLATFORM_VIEW | aView | ) |
Keeps a reference to the platform specific view for internal use.
aView | A platform specific view. |
bool VisualGraphics::setupContext | ( | ) |
Sets up an OpenGL context of the operating system.
OS windowing system and OpenGL get connected.
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.
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).
zPlane | The z-Coord (optional parameter, default = 0.0). |
void VisualGraphics::translateMatrix | ( | double | xNum, |
double | yNum, | ||
double | zNum | ||
) |
Call of glTranslate().
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.
coordPos | The canvas coord position. |
aCamera | Camera 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.
pixelPos | The canvas pixel position. |
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.
coordPos | The canvas coord position. |
aCamera | Camera 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.
pixelPos | The canvas pixel position. |
aCamera | Camera with dimensions, position, perspective projection, and orientation of stage view. |
The color of the canvas background.
The capabilities.
bool VizKit::VisualGraphics::isSetUpOnFullscreen [private] |
True if set up on full screen, false if set up in windowed mode.
NurbsMap VizKit::VisualGraphics::nurbsMap [private] |
The nurbsMap is the map of the VisualNurbs.
VisualGraphics * VisualGraphics::theVisualGraphics = NULL [static, private] |
VisualGraphics is a singleton class.
Pointer to private instance is handled internally.