2.5.25 IDeckLinkGLScreenPreviewHelper Interface¶
The IDeckLinkGLScreenPreviewHelper interface may be used with a simple IDeckLinkScreenPreviewCallback implementation to provide OpenGL based preview rendering which is decoupled from the incoming or outgoing video stream being previewed.
A reference to an IDeckLinkGLScreenPreviewHelper interface may be obtained from CoCreateInstance() on platforms with native COM support or from CreateOpenGLScreenPreviewHelper() (OpenGL 2.0) or CreateOpenGL3ScreenPreviewHelper() (OpenGL 3.2) on other platforms.
Typical usage of IDeckLinkGLScreenPreviewHelper is as follows:
Configure an OpenGL context as an orthographic projection using code similar to the following:
glViewport(0, 0, (GLsizei)newSize.width, (GLsizei)newSize.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
Create an
IDeckLinkGLScreenPreviewHelperobject interface usingCoCreateInstance()orCreateOpenGLScreenPreviewHelper()Call
IDeckLinkGLScreenPreviewHelper::InitializeGL()from the OpenGL contextWhen repainting the OpenGL context, call
IDeckLinkGLScreenPreviewHelper::PaintGL(). The preview image will be drawn between (-1,-1) and (1,1) in the GL space.Add any graphical overlays on the preview window as desired.
Create a subclass of
IDeckLinkScreenPreviewCallbackwhich callsIDeckLinkGLScreenPreviewHelper::SetFrame()fromIDeckLinkScreenPreviewCallback::DrawFrame()Register an instance of the
IDeckLinkScreenPreviewCallbacksubclass withIDeckLinkInput::SetScreenPreviewCallback()orIDeckLinkOutput::SetScreenPreviewCallback()as appropriate.
Interface |
Interface ID |
Description |
|---|---|---|
IID_IDeckLinkVideoFrame |
An |
2.5.25.1 IDeckLinkGLScreenPreviewHelper::InitializeGL method¶
-
HRESULT IDeckLinkGLScreenPreviewHelper::InitializeGL();¶
The InitializeGL method should be called from the preview OpenGL context during initialization of that context.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.25.2 IDeckLinkGLScreenPreviewHelper::PaintGL method¶
-
HRESULT IDeckLinkGLScreenPreviewHelper::PaintGL();¶
The PaintGL method should be called from the preview OpenGL context whenever the preview frame needs to be repainted. Frames to be displayed should be provided to
IDeckLinkGLScreenPreviewHelper::SetFrame().PaintGL and SetFrame allow OpenGL updates to be decoupled from new frame availability.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.25.3 IDeckLinkGLScreenPreviewHelper::SetFrame method¶
-
HRESULT IDeckLinkGLScreenPreviewHelper::SetFrame(IDeckLinkVideoFrame *theFrame);¶
The SetFrame method is used to set the preview frame to display on the next call to
IDeckLinkGLScreenPreviewHelper::PaintGL().Depending on the rate and timing of calls to SetFrame and PaintGL, some frames may not be displayed or may be displayed multiple times.
- Parameters:
theFrame – Video frame to preview
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.25.4 IDeckLinkGLScreenPreviewHelper::Set3DPreviewFormat method¶
-
HRESULT IDeckLinkGLScreenPreviewHelper::Set3DPreviewFormat(BMD3DPreviewFormat previewFormat);¶
The Set3DPreviewFormat method is used to set the 3D preview format.
- Parameters:
previewFormat – The 3D preview format. See the Linked frame preview format (
BMD3DPreviewFormat) section for more details.- Return values:
S_OK – Success