Enabling Frame Statistics
A RED::FrameStatistics
object contains a lot of useful informations on what has happened during the previous image rendering. RED::FrameStatistics
can be used by two mechanisms:
They are accessible from any window, through
RED::IWindow::GetFrameStatistics
.They can be retrieved during the processing of a frame using the code snippet below.
// Let's declare a data container to be passed as callback argument and our RED::RENDERING_PROGRESS_CALLBACK:
typedef struct
{
int _data01;
int _data02;
} MyUserData;
RED_RC myProgressCallback( const RED::FrameStatistics& fstats,
void* user_data )
{
// Get a pointer back to your user data:
MyUserData* data = (MyUserData*)user_data;
// Get informations from 'fstats' contents.
return RED_OK;
}
And then the callback just needs to be registered for the window to monitor:
// Create some user data (not mandatory, user data can be ignored):
MyUserData* data = new MyUserData();
if( !data )
RC_TEST( RED_ALLOC_FAILURE );
// Access our window interface ('window' should be your HOOPS Luminate window object here):
RED::IWindow* iwindow = window->As< RED::IWindow >();
// Set our rendering progress callback:
iwindow->SetRenderingProgressCallback( myProgressCallback, data );
The various access methods in the RED::FrameStatistics
class will provide all the details on what happened to the window in terms of rendering. This covers all the rendered VRLs in the window for all cameras rendered by these VRLs.
A RED::FrameStatistics
stored in one window contains one RED::ViewpointStatistics
for each camera in each VRL of the window. Each RED::ViewpointStatistics
instance lets you access a list of RED::PassStatistics
, that contain a description of all what has happened for each rendering pass that had to be processed.
A RED::FrameStatistics
object contains software timers and culling timers enabled by default as these come at no cost. However, hardware timers must be enabled, using calls to RED::FrameStatistics::QueryPassTime
.
A concrete example of FrameStatistics usage can be found in the HOOPS Luminate framework. See RFK::TutorialApplication::ShowInspector
, for the display of the performance inspector.