QWebEngineView加载Cesium报WebGL错

您所在的位置:网站首页 模拟器不支持webgl QWebEngineView加载Cesium报WebGL错

QWebEngineView加载Cesium报WebGL错

2024-01-18 14:34| 来源: 网络整理| 查看: 265

具体错误:

js: Error constructing CesiumWidget.

Visit http://get.webgl.org to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:

RuntimeError: The browser supports WebGL, but initialization failed.

解决办法:

首先查看QWebEngineView是否启用了WebGL

m_pEngineView->load(QUrl(QStringLiteral("chrome://gpu/")));

然后查看reset notification strategy

如果是0x8252则支持WebGL,如果是0x0000则不支持WebGL。

 

我的显示是0x0000,下一步则开启WebGL。

在main函数QApplication或QCoreApplication创建之前添加Qt::AA_ShareOpenGLContexts属性 QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QApplication a(argc, argv); MainWindow w; ......

然后reset notification strategy变为0x8261,说明已经支持WebGL了

再次加载Cesium即可。

m_pEngineView->load(QUrl(QStringLiteral("http://localhost:8082/CesiumEarth/")));



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3