Creating or Destroying a Material

// Access the cluster's resource manager:
RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();
const RED::State& state = iresmgr->BeginState();

// Create a material:
RED::Object* material;
RC_TEST( iresmgr->CreateMaterial( material, state ) );

// Delete the material after use:
RC_TEST( iresmgr->DeleteMaterial( material, state ) );

The material destruction is a transaction managed operation that can occur from the application’s writer thread. It’s the responsibility of the calling application to ensure that the material is not used anymore in HOOPS Luminate prior to its destruction.