Writing to HOOPS Luminate Objects using a Transaction

An application needs a HOOPS Luminate transaction handle to perform any change into HOOPS Luminate. A transaction is opened using RED::IResourceManager::BeginState, and is ended using RED::IResourceManager::EndState. A transaction should only be closed after all needed changes have been made for the current frame, before drawing.

RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();

// Open a transaction to start defining a frame:
const RED::State& state = iresmgr->BeginState();

// Do some changes in HOOPS Luminate (for instance, set an option value in a 'camera' object):
RED::IOptions* ioptions = camera->As< RED::IOptions >();
RC_TEST( ioptions->SetOptionValue( RED::OPTIONS_POLYGON_FILL_MODE, 1, state ) );

// Do all other changes that have to be done by the application.

// Close the transaction:
RC_TEST( iresmgr->EndState() );

// Call the rendering methods (for instance, we'll draw a window 'window'):
RED::IWindow* iwindow = window->As< RED::IWindow >();
RC_TEST( iwindow->FrameDrawing() );

// Repeat the process: reopen another transaction to start defining the next frame...

A transaction that is not closed will not be rendered. All the changes made during the course of the transaction will not take effect if the transaction is not closed.