Rendering video in 3D (OpenGL) windows

The most efficient way to render images into an OpenGL window (like MRPT’s mrpt::gui::CDisplayWindow3D) is to transfer video frames to the video memory and render them as texture of quads.

This can be done manually by means of a mrpt::opengl::CTexturedPlane object within a 3D scene.

But since MRPT 0.9.4 there is an easier way: viewports “image mode“. Refer to the documentation of mrpt::opengl::COpenGLViewport for more information.

You can see also the source code of the samples/opengl_video_viewport_demo example, which creates two windows: one rendering video at the full size of the window, and another with a 3D scene plus a small extra viewport for the video stream.

Source code: