Configuring a window
Some parameters in a REDsdk window can't be modified after its creation. All these parameters are stored in the RED::WindowRenderInfo class that can be optionally sent to RED::Factory::CreateREDWindow method.
RED::WindowRenderInfo
The RED::WindowRenderInfo class lists parameters that can be toggled to customize the window creation, and that can't be modified afterwards:
- External rendering OpenGL context: A REDsdk window can be created using the existing OpenGL context of an application window.
- Vertical synchronization control: The window can have it's vertical synchronization turned on (it's off by default).
- Buffer swapping control: The window can have a disabled buffer swapping. In this case, the application must do the buffer swapping on its own. This is very useful in the case of the integration in an existing application window that has some rendering code, executed before or after REDsdk's own code.
- Hardware anti-aliasing: Unlike other REDsdk anti-aliasing, OpenGL driver based anti-aliasing can be enabled from the RED::WindowRenderInfo.
- Stereoscopic display: REDsdk supports stereoscopic display, that can be requested for the window from the RED::WindowRenderInfo.
Adjusting the window size with OS decorations
The real size of the REDsdk rendering window should take into consideration the operating system decorations that can modify the real visible size of the display area. The code snippet below illustrates this:
// If we want a rendering window whose dimensions are set to 'width' and 'height' pixels:
int width = 1200;
int height = 800;
// On Windows, adjust the window dimensions to take the system window decorations into consideration:
RECT rect;
rect.top = 0;
rect.left = 0;
rect.bottom = height;
rect.right = width;
AdjustWindowRectEx( &rect, WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE, NULL, WS_EX_CLIENTEDGE );
HWND hwnd = CreateWindowEx( WS_EX_CLIENTEDGE,
L"REDsdk",
L"myWindow",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE,
0, 0, ( rect.right - rect.left ), ( rect.bottom - rect.top ),
NULL, NULL, GetModuleHandle( NULL ), NULL );
RED_RC rc;
RED::Object* window = RED::Factory::CreateREDWindow( *resmgr, hwnd, width, height, NULL, rc );
![]() | Integration into an external OpenGL window![]() |