Integrating a REDsdk window into an existing OpenGL window

A REDsdk window can be created from a window handle provided by the application (a HWND on Windows, a NSView on OSX, a Display / Visual / Screen info on Linux). In this case, the REDsdk window internally creates and manages the OpenGL context it'll use for the rendering. In REDsdk, it's possible to create a window that uses an OpenGL context that exist already and that is used by the hosting application already:

// Assuming we have an application that has a running OpenGL window:
//  - 'app_hwnd' must be be a valid application handle (HWND).
//  - 'app_hdc' is a valid application device context (HDC).
//  - 'app_hglrc' is a valid application OpenGL context (HGLRC).
RED_RC rc;
RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
int width = 1920;
int height = 1080;

// Create a RED::WindowRenderInfo instance to setup external OpenGL parameters:
RED::WindowRenderInfo winfo;
winfo.SetHostingContext( app_hdc, app_hglrc );

// Create a rendering window using the external context specification:
RED::Object* window = RED::Factory::CreateREDWindow( *resmgr, app_hwnd, width, height, &winfo, rc );
if( !window )
  // Handle critical errors here.
if( rc != RED_OK )
  // Handle error codes here.

Once created, REDsdk can be used to draw in the application window directly, co-existing with the application's OpenGL code. See Integration into an external OpenGL window for details on how to proceed.