User Tools

Site Tools


Error System

The SpeedTree error system is housed as a static function within the CCore class. All of the classes within the SDK framework use this interface for run-time errors. It is a simple system that returns string error descriptions, not enumerations. Errors will also accrue in a stack as they occur.

Errors are queried using CCore::GetError(), which returns a const char*. It will be NULL if there is no error.

The errors reported by the SDK through this system are written to be understood by developers, not end users. It is not recommended that these errors are propagated up into anything that an end user will see. More often than not, the error will consist of function names with technical explanations of what failed (e.g. bad pointer, etc.).

It is recommended that developers check for errors frequently, placing at least one query per frame in debug mode. The following function will print all of the queued SpeedTree errors for a given time:

using namespace SpeedTree;
 
///////////////////////////////////////////////////////////////////////
//  PrintSpeedTreeErrors
 
inline void PrintSpeedTreeErrors(void)
{
    const char* pError = SpeedTree::CCore::GetError( );
    while (pError)
    {
        fprintf(stderr, "SpeedTree Error: %s\n", pError);
 
        pError = CCore::GetError( );
    }
}