Skip to content

Commit 97275fc

Browse files
committed
Allow users to disable the loading/waiting screen animation
Allows the user to disable the browser loading animation for debugging purposes. WebGL Inspector tries to debug the loading screen instead of the proper WebGL context. It can be disabled setting the QT_WEBGL_LOADINGSCREEN environment variable to '0' or sending the 'noloadingscreen' parameter to the QPA plugin. By default, the browser will show the loading screen. Change-Id: I5d84173d79c3f3fc67b776ba2f8fc8928a0194a1 Reviewed-by: Edward Welbourne <[email protected]>
1 parent 61bc1d8 commit 97275fc

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/plugins/platforms/webgl/qwebglmain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ QPlatformIntegration* QWebGLIntegrationPlugin::create(const QString& system,
6262
return nullptr;
6363
}
6464
}
65+
if (parts.first() == QStringLiteral("noloadingscreen"))
66+
qputenv("QT_WEBGL_LOADINGSCREEN", "0");
6567
}
6668
}
6769
if (!system.compare(QLatin1String("webgl"), Qt::CaseInsensitive))

src/plugins/platforms/webgl/qwebglwebsocketserver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ void QWebGLWebSocketServer::onNewConnection()
294294
false
295295
#endif
296296
},
297+
{ QStringLiteral("loadingScreen"), qgetenv("QT_WEBGL_LOADINGSCREEN") },
297298
{ "sysinfo",
298299
QVariantMap {
299300
{ QStringLiteral("buildAbi"), QSysInfo::buildAbi() },

src/plugins/platforms/webgl/webqt.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function physicalSizeRatio() {
3434

3535
window.onload = function () {
3636
var DEBUG = 0;
37+
var LOADINGSCREEN = 1;
3738
var canvas;
3839
var socket = new WebSocket("ws://" + host + ":" + port);
3940
socket.binaryType = "arraybuffer";
@@ -113,6 +114,8 @@ window.onload = function () {
113114
var body = document.getElementsByTagName("body")[0];
114115
body.appendChild(canvas);
115116

117+
if (!LOADINGSCREEN)
118+
return canvas;
116119
var gl = canvas.getContext("webgl");
117120

118121
var loadingVertexShaderSource =
@@ -1186,6 +1189,8 @@ window.onload = function () {
11861189
var sysinfo = obj["sysinfo"];
11871190
if (obj["debug"])
11881191
DEBUG = 1;
1192+
if (obj["loadingScreen"] === "0")
1193+
LOADINGSCREEN = 0;
11891194
console.log(sysinfo);
11901195
} else {
11911196
console.error("Unknown message type");

0 commit comments

Comments
 (0)