有什么方法可以在不使用OpenGL的情况下使用QtWebEngine? [英] Is there any way to use QtWebEngine without OpenGL?

查看:1339
本文介绍了有什么方法可以在不使用OpenGL的情况下使用QtWebEngine?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让QtWebEngine在VM上运行,并且遇到了困难.根据这个问题的答案:

I'm trying to get QtWebEngine running on a VM and am having difficulties. According to the answer to this question:

最终,我意识到OpenGL 3.3在虚拟机上仍无法轻松运行.我必须从ubuntu usb引导并通过安装最新的mesa 3d软件包从那里工作.

Eventually I realised that OpenGL 3.3 wouldn't work easily on virtual machines .. yet. I had to boot from ubuntu usb and work from there by installing latest mesa 3d package.

有没有一种方法可以使QtWebEngine在不使用OpenGL的情况下工作?我没有直接使用任何OpenGL调用,也不需要任何3d功能.我只想嵌入QWebEngineView来显示动态HTML页面.我猜测这应该可行,因为Chrome可以在同一个VM上正常工作.

Is there a way to get QtWebEngine to work without OpenGL? I'm not directly using any OpenGL calls, nor do I need any 3d capabilities. I just want to embed a QWebEngineView to display dynamic HTML pages. I'm guessing this should be possible since Chrome works on the same VM without an issue.

推荐答案

我认为没有OpenGL不能使用Qt WebEngine.在文档中并没有非常明确地说明这一点,但这是我从发现的内容中所了解的.

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

这里,QtWebEngine将Chrome的快速移动Web功能集成到了Qt中.另外,Chromium允许通过Qt Quick场景图操纵OpenGL(源代码):

As it is said here, QtWebEngine integrates chromium's fast moving web capabilities into Qt. Plus, it is Chromium that allows the manipulation of OpenGL via the Qt Quick scene graph (source) :

铬与Qt Quick场景图紧密集成在一起, 基于OpenGL ES 2.0或OpenGL 2.0的渲染.这提供了 一站式合成Web内容和所有Qt Quick UI. 与Chromium的集成对于开发人员来说是透明的, 使用Qt和JavaScript.

Chromium is tightly integrated to the Qt Quick scene graph, which is based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides you with one-pass compositing of web content and all the Qt Quick UI. The integration to Chromium is transparent to developers, who just work with Qt and JavaScript.

也有人说,渲染过程和GUI过程都应该共享OpenGL上下文:

It is also said that both the render process and the GUI process should share an OpenGL context :

由于渲染进程与GUI进程是分开的,因此它们 理想情况下,应该共享一个OpenGL上下文,以使一个进程能够访问 对方上传的资源,例如图像或纹理.

Because the render process is separated from the GUI process, they should ideally share an OpenGL context to enable one process to access the resources uploaded by the other, such as images or textures.

关于Qt WebEngine本身

我们只是讨论了Qt的GUI:实际上,Qt WebEngine不依赖于此GUI(页面渲染和JavaScript执行从GUI进程分离到Qt WebEngine进程中),但是请记住,如果您想要应用程序要工作,您将需要在两个进程之间共享一个OpenGL上下文.特别是,默认情况下,这是通过 QSurfaceFormat 实现的,该文件的可通过功能 QSurfaceFormat :: profile()访问.现在,我们回顾一下 Qt WebEngine平台注释,其中指出:

About the Qt WebEngine itself

We just talked about the Qt's GUI : in fact, the Qt WebEngine is not dependent of this GUI (page rendering and JavaScript execution are separated from the GUI process into the Qt WebEngine process), but remember that if you want your application to work, you will need to share an OpenGL context between both processes. In particular, this is achieved by default with a QSurfaceFormat, which has a OpenGLContextProfile accessible by the function QSurfaceFormat::profile(). Now, we look back at the Qt WebEngine platform notes which states :

如果具有修改后的OpenGL配置文件的新默认QSurfaceFormat必须 设置,它应该在声明应用程序实例之前设置, 确保所有创建的OpenGL上下文都使用相同的OpenGL 个人资料.

If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set before the application instance is declared, to make sure that all created OpenGL contexts use the same OpenGL profile.

在OS X上,如果在应用程序之后设置了默认QSurfaceFormat 实例,应用程序将以qFatal()退出,并显示一条消息 应在应用程序之前设置默认的QSurfaceFormat 实例.

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

如果我们看一下Qt的源代码,则OpenGL的调用是在几个重要文件中进行的,例如qtwebengine\src\core\web_engine_context.cppqtwebengine\src\webengine\api\qtwebengineglobal.cpp.此外,我还在qtwebengine\src\3rdparty\chromium\的源代码中找到了对OpenGL的调用,因此我怀疑Chromium有时需要调用OpenGL函数.

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

Qt WebEngine使用Chromium(不一定使用OpenGL)以及Qt GUI,Qt GUI使用必须由Web Engine共享的OpenGL上下文.因此,我的结论是,没有OpenGL,您将无法使用Qt WebEngine.

The Qt WebEngine is using Chromium (which doesn't necessarily use OpenGL) and also Qt GUI, which uses an OpenGL context which has to be shared by the Web Engine. Thus, my conclusion is that you can't use the Qt WebEngine without OpenGL.

这篇关于有什么方法可以在不使用OpenGL的情况下使用QtWebEngine?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆