Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
OpenGL initialization and rendering problem
Vladimir Orlov last edited by
I need to initialize 3rd-party library which does some OpenGL rendering. First it must init & load some resources, then the rendering happens. BUT the rendering isn't immediate. User must do some actions for it to happen.
I tried to use precreated QOpenGLWidget, but its context is not initialized until the first draw request. So I can't initialize my library until I trigger QOpenGLWidget context creation (and I don't know any clean way to do that). It breaks all the architecture and user workflow.
Then I tried to create QOpenGLContext manually, but it requires the surface to be made current and it can't be passed to QOpenGLWidget to be used / shared with it.
So the question is what is the best approach to do offscreen initialization of OpenGL-based third-party library and render its output separately. Maybe load-time QOffscreenSurface + render-time QWidget will do the job but I don't like to reimplement all the QOpenGLWidget logic again if possible.
Thanks in advance.
Hi and welcome to devnet,
What 3rd-party library is that ?