#######################################################
Creating a HOOPS Luminate Window using the RED::Factory
#######################################################

.. code:: cpp
    
    // 'application_window' must be a valid application HWND pointer.
    RED_RC rc;
    HWND hwnd = application_window;
    RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
    int width = 1920;
    int height = 1080;

    // Create a rendering window:
    RED::Object* window = RED::Factory::CreateREDWindow( *resmgr, hwnd, width, height, NULL, rc );
    if( !window )
    {
        // Handle critical errors here.
    }
    if( rc != RED_OK )
    {
        // Handle error codes here.
    }

In this example, we only show the windows OS code. The window creation works similarly on Linux and MacOS, provided the operating specific parameters. See the ``RED::Factory::CreateREDWindow`` method for details. Please note that it's mandatory to check the window creation return code to be sure that the operation has succeeded. 
