Desperately need help porting to QOpenGLWidget and maintaining threaded rendering
Hello there. We have a product that renders up to 3 images (raw data so we're using QImage) onto a surface. I had started with a proof of concept which ill attach (the real app is much more complicated but uses the same rendering code) and have the surface fully rendering in a separate thread from the UI. Between 4 developers over weeks we've not been able to successfully port this to QOpenGLWidget and maintain a separate rendering thread. It feels like something really subtle but easy, 1 line out of place or something.
- Does anyone know how long until we loose QGLWidget?
- Anyone know how to port the attached to QOpenGLWidget correctly? This is my working prototype using QGLWidget (based on hypnotizer)
- Not before Qt 6
- Did you check QOpenGLContext::supportsThreadedOpenGL ?
@SGaist Yes, I get back true. And the attached demo does work on the same machine.
If I I simply flip everything over from QGLWidget to QOpenGLWidget (along with just a couple small changes since it's constructor is different), I get the following when I "start rendering"
"Cannot make QOpenGLContext current in a different thread"
If I press Ignore on the dialog, it starts to render anyways, but is sort of sporadic, hard to explain. If QOpenGLWidget is to be a replacement for QGLWidget, it should be capable of the same things at least, no?
What OS are you on ?
There might be some adjustment to do but yes, it should do the same.
@SGaist Windows & Mac, the demo I attached works on both.