0

I have 2 physical displays in my hardware and I need to render video frames alternatively on the 2 displays with my C++ application.

I have created a renderer module to render video frames. I have initialized the renderer module with OpenGL context with first(default) display.

I need to render video frames only in first display for few seconds and then to render only in second display for the next few seconds and render back again in first display.

e.g. Sample code

int display_1 = 0;
int display_2 = 1;

displayId1  = opendisplay(display_1);
oglcontext = CreateOGLContext(displayId1);  // (involves calls to eglGetDisplay, eglInitialize, eglCreatePbufferSurface, eglCreateContext, eglMakeCurrent)

InitializeRenderer(oglcontext);
render();

displayId2  = opendisplay(display_2);
oglcontext = CreateOGLContext(displayId2);
InitializeRenderer(oglcontext);
render();

To render on the second display, I opened the display and do I need to re-initialize my renderer with new openGL context with second display?

Can I use multithread to render with two openGL contexts? Or is there any other way to achieve it?

Arun AC
  • 417
  • 7
  • 17
  • 1
    You need to be a lot more specific about what you understand by "display", and your whole problem in general. That being said: *There is no hard connection between an OpenGL context and a particular window. In Windows you use a window's HDC to create an OpenGL context, but the HDC is only used here as a proxy for the internal formats used by the context. Once you have the OpenGL context in place, you can re-bind it to any window that has a pixelformat compatible to the window that was used to obtain the HDC the context was created with.* – datenwolf Feb 27 '23 at 19:49

0 Answers0