As also discussed in issue #2952
we have some major problems with OpenGL with Qt5. With Qt4 we had three options to create an image from the 3d view using off-screen rendering:
- QGLPixelBuffer: this gives (if supported by the HW/driver) the best results and supported anti-aliasing and handled transparencies pretty well
- QGLFramebufferObject: if the 1st option is not supported this option can be used. It also supports anti-aliasing but gives totally garbage for transparencies
- Coin's off-screen renderer: this method is independent of Qt stuff and internally also uses pixel buffers. Like the 1st option it also supports transparencies but doesn't offer a way to handle anti-aliasing.
Now with Qt5 it seems pixel buffer support has been completely dropped (at least I didn't find a way to get it back). Although with the deprecated OpenGL classes it's still offered by the API but internally it uses QGLFramebufferObject. This means we now have two sub-optimal solutions to create images.
So if someone knows if pixel buffer is possible with Qt5 tell me, please.
Now to the QOpenGL* port:
I have moved this branch https://github.com/wwmayer/FreeCAD/tree/qtopengl
which at least compiles but the 3d view doesn't work at all. I guess it's related to our changes on the QuarterWidget class. So, if you create a new document then sometimes you can see the 3d window for a little moment but then the whole application becomes black.
At the moment at least the image viewer works fine.
If someone wants to test you have to set the option BUILD_QT5 of course and additionally the option FREECAD_USE_QTOPENGL_WIDGET which is off by default.
Currently there are some open points:
- Get the 3d view working again (works with limitations)
- Implement a way to get some information about OpenGL support at startup (done)
- Find a replacement to get real pixel buffer support (done)
- Find a replacement for qglColor (done)
- Find a replacement for QGLWidget::renderText (done)
- Find a replacement for QtGLWidget::convertToGLFormat (done)
Edit: for off-screen rendering it seems QOffscreenSurface
is the way to go. And the good thing is that internally it uses pixel buffers if supported.