Glitchy rendering with GLES3, QOpenGLWidget, Qt6.4
-
Hello,
first of all, thanks for fixing QOpenGLWidget!
However, i'm experiencing heavy glitching in my widget application.
This exact same code works fine both in a desktop Qt context and as a non-Qt webapp.I've enabled GLES3 by compiling Qt with
-feature-opengles3
and my application with-s FULL_ES3=1 -s USE_WEBGL2=1
.
The runtime configuration is by setting the surface format before calling.show()
&exec()
:QSurfaceFormat format = QSurfaceFormat::defaultFormat(); format.setVersion(3, 0); format.setRenderableType(QSurfaceFormat::OpenGLES); QSurfaceFormat::setDefaultFormat(format);
The first weird observation is that
glGetString(GL_VERSION)
reportsOpenGL ES 2.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
, whereasglGetString(GL_SHADING_LANGUAGE_VERSION)
reportsOpenGL ES GLSL ES 3.00 (WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium))
.The app then kind of works without crashes or error messages on the console, but drawing is about 50% broken.
My GL scene consists of 3 kinds of objects- the first is rendered correctly
- the second is not rendered at all
- the third is rendered only in the first frame that it is present, then not any more for the runtime of the app.
There are many "dropouts" where only a blank screen is rendered, or the regular widgets are rendered and the QOpenGLWidget is gray (?!).
This can be "toggled" by triggering some draw update from the regular widgets, or interestingly enough, almost fixed by enabling the (not actually displayed themselves) third kind of objects...Further observations:
- GL Widget is also gray whenever a dropdown menu is rendered
- when using multiple GL Widgets, only the last one updates correctly, the previous ones are sometimes updated to the state of the last one but cannot work on their own anymore (not very interested in this, just mentioning for completeness)
I'd be incredibly grateful if someone could point me in any useful direction as i have no clue how to debug this.
Thanks for your time! -
opengles 3 in webassembly is transcompiled into webgl2, with emscripten emulations which may or may not work as expected.
https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -
Sorry, should have been more clear about this point:
I have the "same" rendering code successfully running in webassembly (https://sgsaenger.github.io/vipster/emscripten/), so it should be more or less correct.This standalone app obtains canvas and webgl2 context via the emscripten helper functions, so
glGetString(GL_VERSION)
reportsOpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
as expected.
Note the weird mismatch inOpenGL ES 2.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
when Qt is doing its initialization first.My guess is that somewhere there's a conflict between my setup code (or expectations) and what Qt is doing before
initGL()
is reached.
Is there maybe any working GLES3 QOpenGLWidget examples?