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?