Streaming a DAG to a .red File
------------------------------

Once you get a pointer to the root of your DAG (and your file is properly created), you can stream its whole content to a .red file very easily:

.. code:: cpp

    // root is a pointer to a DAG root (or any other shape into a DAG)
    // ired_file is a pointer to a RED::IREDFile interface
    // resmgr is a pointer to the RED resource manager

    RED::StreamingPolicy policy;
    RC_TEST( ired_file->WriteDAG( root, policy, resmgr ) );

This call ensures that all the dependencies are saved together with the DAG data (including materials, shaders, textures and so on). You get the whole thing into a single compressed archive which can be reloaded by any other HOOPS Luminate-based application, on any platform.

.. note:: 
    
    You can customize the way data are compressed by specifying additional parameter values to the ``RED::StreamingPolicy`` instance (see :doc:`/tasks/ta_ca/ta_ca_file/tk_defining_red_file_policy` for further details) 
