Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Glitchy rendering with GLES3, QOpenGLWidget, Qt6.4
Forum Updated to NodeBB v4.3 + New Features

Glitchy rendering with GLES3, QOpenGLWidget, Qt6.4

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
3 Posts 2 Posters 516 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sgsaenger
    wrote on last edited by
    #1

    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) reports OpenGL ES 2.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium)), whereas glGetString(GL_SHADING_LANGUAGE_VERSION) reports OpenGL 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!

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by
      #2

      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

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sgsaenger
        wrote on last edited by sgsaenger
        #3

        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) reports OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium)) as expected.
        Note the weird mismatch in OpenGL 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?

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved