I have 4 camera objects. Each camera Object refreshes frames independently. I would like to visualize these frames on my videowall class. Basicly, my videowall is just a gridlayout child with draw Widget methods.
Each camera object has imageHolder widget. ImageHolder widget is a child of qOpenglWidget with
void OpenGLImageHolder::display(const QImage* img)
{
m_image = img;
this->update();
}
void OpenGLImageHolder::paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.drawImage(this->rect(), *m_image);
}
Each Image Holder has a QTimer and QTimer::timeOut() is connected to OpenGLImageHolder::display().
Unfortunatelly, with this setup, I can visualize only 3 cameras simultaniously. If I add 4th camera, one of three (or two) freezes. I know that display was called, because when I resizeWidget, I get a correct Image update.
What is the right way to make videoWall? Shall I make one openglWidget with its own window, and then draw images directly on this openglWidget? Which tools can I use to profile the behaviour (it seems that standart msvs profiler is not enough).
My design:
Each camera uses a thread that prepares an image. The image is created when needed or by a timer. When it's ready, the thread signals the main thread.
The main thread handles the signal. Loads the image to the GPU as a texture an draw it by a simple quad.
The trick is to use an unique window, but a different
glViewport
for each camera.Other solution is to use a texture for the whole window and update the rectangle each camera uses.