Creating and Destroying Images
// First, get our resource manager and access its interface.
RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();
// Then, create an image from it (here a 2D image in this example):
RED::Object* image2D;
RC_TEST( iresmgr->CreateImage2D( image2D, iresmgr->GetState() ) );
// Release the image after use:
RC_TEST( iresmgr->DeleteImage( image2D, iresmgr->GetState() ) );
Images are shared resources. Most of the time, they get used by shader parameters (see the RED::RenderShaderParameter class
). It’s the responsibility of the application to ensure that an image is no longer used anymore when a draw occurs after the destruction of the image. HOOPS Luminate may detect invalid images addresses still used in a scene graph and will return a RED_SCG_INVALID_IMAGE_ADDRESS
during the draw of that scene graph.