Is there a way to use QtWebEngine without OpenGL?

I am trying to run QtWebEngine in a virtual machine and am having difficulty. According to the answer to this question :

In the end, I realized that OpenGL 3.3 would not work on virtual machines. I had to boot from Ubuntu usb and work from there by installing the latest mesa 3d package.

Is there a way to get QtWebEngine to work without OpenGL? I don't directly use any OpenGL calls, and I don't need any 3D features. I just want to embed a QWebEngineView to display dynamic HTML pages. I guess this should be possible, since Chrome runs on the same virtual machine without any problems.

+5
source share
1 answer

I don't think there is a way to use Qt WebEngine without OpenGL . This is not very clearly stated in the documentation, but here is what I understood from what I found.

About Chromium

As said here , QtWebEngine integrates Chrome’s high-speed web features into Qt. In addition, this Chromium allows you to manipulate OpenGL using the Qt Quick ( source ) scene graph:

Chrome is closely related to the Qt Quick scene graphics, which is based on OpenGL ES 2.0 or OpenGL 2.0 for rendering it. This provides you with a one-pass composition of web content and the entire Qt Quick UI. Integration with Chromium is transparent to developers who simply work with Qt and JavaScript.

It is also said that both the visualization process and the GUI process must share the OpenGL context:

Because the rendering process is separate from the GUI process, they should ideally share an OpenGL context that allows one process to access resources loaded by another, such as images or textures.

About Qt WebEngine itself

We just talked about the Qt GUI: in fact, Qt WebEngine is independent of this GUI (page rendering and JavaScript are separate from the GUI process in the Qt WebEngine process), but remember that if you want your application to work for you You will need to share the OpenGL context between both processes. In particular, this is achieved by default using QSurfaceFormat , which has an OpenGLContextProfile accessible by the QSurfaceFormat :: profile () function. Now we will take a look at the Qt WebEngine platform notes , which say:

If a new standard QSurfaceFormat with a modified OpenGL profile must be installed, it must be installed before the application instance is declared, so that all created OpenGL contexts use the same OpenGL profile.

In OS X, if the default QSurfaceFormat is installed after the application instance, the application will exit with qFatal () and print a message that the default QSurfaceFormat must be installed before the application instance.

If we look at the Qt source code, OpenGL calls are made in several important files, for example qtwebengine\src\core\web_engine_context.cpp or qtwebengine\src\webengine\api\qtwebengineglobal.cpp . Moreover, I also found OpenGL calls in functions from sources in qtwebengine\src\3rdparty\chromium\ , so I suspect Chromium sometimes has to call OpenGL functions.

In short

Qt WebEngine uses Chromium (which does not necessarily use OpenGL), as well as the Qt GUI, which uses the OpenGL context that Web Engine should use. So my conclusion is that you cannot use Qt WebEngine without OpenGL.

+2
source

Source: https://habr.com/ru/post/1233559/


All Articles