QWebEngine causes problems in custom OpenGL renderer
Our team is upgrading from qt 5.3 to 5.7, can't do 5.8 just yet.
We do simulations and occasionally we display web content and were using QtWebKit to do so. While using QtWebKit we were not having any problems between Qt and our in house renderer.
When we swapped in QWebEngine is when opengl started to throw errors in our rendering code.
We initialize QWebEngine at the start of the application and everything is fine, but when we try to load a web page we get an opengl error.
When we load a web page is random, its done through user interaction, it could be seconds after everything is loaded or minutes.
If our renderer is disabled just before loading a web page and then re-enabled after its loaded, no error's are thrown.
If we don't disable our renderer and close the web page, errors are thrown.
And if it is disable, close the page and then re-enable errors are thrown.
Normally our renderer is threaded, the rendering operations are done on a seperate thread, but for these tests our renderer is moved to the main thread. There is no difference in behavior it is threaded or not.
The error's we see are,
In glClientWaitSync we get GL_INVALID_ENUM when trying to delete the sync object
And in glDrawArrays, no error is given it just halts, if debugging. If not debugging, the app just closes down.
I have tried using opengl's debug message callback (GL_ARB_debug_output) which is how we see GL_INVALID_ENUM for glClientWaitSync, but the callback is not called when glDrawArrays errors out.
Steps have been taken to ensure the Opengl version and profile type are then same, 3.2 compatibility, between our renderer and Qt's Globally shared opengl context. This may be different from QWebEngines. The documentation stats that QWebEngine uses opengl 2.x, but I can't confirm this.
The pixel format may be different, I'm not sure how to get QWebEngines to test if they are the same.
Did you try to put
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);before initializing the webengine?
I use QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); It can really screen bugs。but , error too;