I am programming a VR app in Qt and need to show QWidget on the desktop and also inside VR.
So far I am rendering like this:
QOpenGLPaintDevice device(QSize(w12,h12));
QPainter painter(&device);
gl_functions->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
//painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
gl_functions->glClearColor(0.0, 0.0, 0.0, 0.0);
gl_functions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
//QPixmap pixmap(widget2->size());
//widget2->render(&pixmap);
//pixmap.save("pic.jpg");
widget2->render(&painter);
This is called from paintGL() of the main QOpenGLWidget.
In Vr this texture is used on a quad. So far only the text gets rendered. If QPixmap is used as device the widget renders fine.
My Widget is very complex with 4k lines of code for connnections between all spinboxes, labels, ...