Creating a 3D image

RED::Object* image_3d;

// Create the image.
RC_TEST( iresmgr->CreateImage3D( image_3d, iresmgr->GetState() ) );

RED::IImage3D* i3d = image_3d->As< RED::IImage3D >();

// Let the engine to allocate the image 256x256x256 pixels array for us.
RC_TEST( i3d->SetLocalPixels( NULL, RED::FMT_RGB, 256, 256, 256 ) );

unsigned char* pixels = i3d->GetLocalPixels();
for( int z = 0; z < 256; ++z )
  for( int y = 0; y < 256; ++y )
    for( int x = 0; x < 256; ++x )
      // Fill in the texture...

// Set the texture content to the renderer.
RC_TEST( i3d->SetPixels( RED::TGT_TEX_3D, iresmgr->GetState() ) );

This code sample creates a 3D image, uses REDsdk to allocate a local pixel array in the image and uploads the contents of this local pixel array in the engine (therefore on the GPU if REDsdk uses GPU rendering, and in CPU memory is REDsdk uses software rendering). The local pixel array remains. It can be deleted if not needed anymore using RED::IImage3D::ClearLocalPixels.