Horde3D Utility Library Reference

Overview

Horde3D has a simple core API which offers all the functionality needed to control the engine. The engine core is intended to be as generic as possible to make the complete system lightweight and clean. Nevertheless it is sometimes useful to have more specific functions in order to increase productivity. For this reason the Utility Library is offered. It has some very handy functions that can help to make your life easier.


Function overview

This is a list of the functions of the Horde3D Utility Library.

General

OpenGL

Resource management

Overlays



Function details

The following functions are all in the namespace Horde3DUtils


bool createTGAImage( const unsigned char *pixels, uint width, uint height, uint bpp, char **outData, uint *outSize )

Creates a TGA image in memory.

This utility function allocates memory for the pointer outData and creates a TGA image from the specified pixel data. The dimensions of the image have to be specified as well as the bit depth of the pixel data. The created TGA-image-data can be used as Texture2D or TexureCube resource in the engine.
Note: The memory allocated by this routine has to freed manually with the freeMem function.

Parameters:
pixels   pointer to pixel source data from which TGA-image-data is constructed;
memory layout: pixel with position (x, y) in image (origin of image is upper left corner) has memory location (y * width + x) * (bpp / 8) in pixels array
width   image width of source data
height   image height of source data
bpp   color bit depth of source data (Valid: 24, 32)
outData   address of a pointer to which the address of the created memory block is written
outSize   variable to which to size of the created memory block is written
Returns:
true in case of success, otherwise false


bool dumpMessages( )

Writes all messages in the queue to a log file.

This utility function pops all messages from the message queue and writes them to a HTML formated log file 'EngineLog.html'.

Parameters:
none
Returns:
true in case of success, otherwise false


void freeMem( char **ptr )

Frees memory allocated by the Utility Library.

This utility function frees the memory that was allocated by another function of the Utility Library.

Parameters:
ptr   address of a pointer that references to memory allocated by the Utility Library
Returns:
nothing


bool initOpenGL( int hDC )

Initializes OpenGL.

This utility function initializes an OpenGL rendering context in a specified window component.
The function is only available on Windows platforms.

Parameters:
hDC   handle to device context for which OpenGL context shall be created
Returns:
true in case of success, otherwise false


bool loadResourcesFromDisk( const char *contentDir )

Loads previously added resources from a data drive.

This utility function loads previously added and still unloaded resources from a specified directory on a data drive. All resource names are directly converted to filenames when being loaded.

Parameters:
contentDir   directory where data is located on the drive
Returns:
false if at least one resource could not be loaded, otherwise true


void releaseOpenGL( )

Releases OpenGL.

This utility function destroys the previously created OpenGL rendering context.
The function is only available on Windows platforms.

Parameters:
none
Returns:
nothing


void showText( const char *text, float x, float y, float size, unsigned int layer, unsigned int fontMatRes )

Shows text on the screen using a font texture.

This utility function uses overlays to display a text string at a specified position on the screen. The font texture of the specified font material has to be a regular 16x16 grid containing all ASCII characters in row-major order. The layer corresponds to the layer parameter of overlays.

Parameters:
text   text string to be displayed
x, y   position of the lower left corner of the first character;
for more details on coordinate system see overlay documentation
size   size factor of the font
layer   layer index of the font overlays (values: 0-7)
fontMatRes   font material resource used for rendering
Returns:
nothing


void swapBuffers( )

Displays the rendered image on the screen.
The function is only available on Windows platforms.

This utility function displays the image rendered to the previously initialized OpenGL context on the screen by copying the OpenGL backbuffer to the window front buffer.

Parameters:
none
Returns:
nothing


Copyright © 2006-2007 Nicolas Schulz