Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT5 with EGLFS - WebGL not working



  • QT5 with EGLFS - WebGL is not working.

    Command used:
    @QtTestBrowser -graphicsbased -gl-viewport -webgl http://get.webgl.org/@

    Fails in: WebGLRenderingContext.cpp
    @
    if (!context || !context->makeContextCurrent()) {
    canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
    return nullptr;
    }
    @

    The context fails as it doesnt create surface in the context and there is no code if it is not @GraphicsContext3D::RenderToCurrentGLContext
    @

    If we pass RenderToCurrentGLContext for context creation, then makeContextCurrent() fails.

    Anybody was able make it work??



  • Found that WebGL is available only for X-Windows and not available for EGLFS. :(



  • WebGL is indeed available in non-X platforms.

    When you built Webkit - did the configure step show WebGL-yes, as shown in my configuration below ?

    http://www.gpupowered.org/node/15



  • It configures WebGL but for EGLFS, it lacks implementation of GLSruface and GLContext.
    Hence when HTML request webgl-context, it returns null .



  • You can use the (dirty) patchset attached to the bug report at,

    https://bugreports.qt-project.org/browse/QTBUG-30405

    I will update some of the patches soon,



  • Can you please check now - I have updated ? For some reason, comments did not get posted, or I might have closed the window too soon earlier.



  • Actually, I tried to create a EGLContext and EGLSurface in the 3DPrivate class. But it requires the QOpenGLContext class.

    Hence I tried deriving class QPlatformOpenGLContext. But with this setContext() is called from QOpenGLContext. This is done in QOpenGLContext::create(), which takes: QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this); to set the context.

    So just introduce a QGLWidget. Now this shows only WebGL screen and not "blending" with the actual screen.

    I will take look at your changes. Mean while if you have any suggestion, let me know.



  • With the patch, I was not able to run the GL pages.
    First, while compiling I had to disable inclusion of X libraries.
    After running swapbuffer() was giving the error:
    @
    QOpenGLContext::swapBuffers() called with non-opengl surface
    QOpenGLContext::swapBuffers() called with non-opengl surface
    QOpenGLContext::swapBuffers() called with non-opengl surface
    QOpenGLContext::swapBuffers() called with non-opengl surface
    ...
    ...
    @

    I was trying to run:

    "http://www.erpoyart.com/jsdyn/":http://www.erpoyart.com/jsdyn/



  • Can you please post the command line you are using to run ?



  • @./QtTestBrowser -graphicsbased -gl-viewport -webgl http://www.erpoyart.com/jsdyn/@



  • Actually I was checking .. looks like even though it prints the error which i have reported for some time, but later i see that FPS saying that as per App, WebGL is working. But its not visible. I just put a print in the
    @
    GraphicsSurface::platformPaintToTextureMapper
    @

    and its printing.

    Does that mean only "display" or final blit on to surface is not happening??



  • "QOpenGLContext::swapBuffers() called with non-opengl surface"

    Can be solved by marking all EGLFSWindows as OpenGLSurface in qeglfswindow.cpp.



  • Hello Hari,

    Its been a while since I worked on this, I found that qt5.1.x has an issue with WebGL that needs a fix in the eglfs plugin that causes the issue you mention below. I posted my patch-set here:

    https://github.com/prabindh/qt-configs/tree/master/webgl_5.1.1

    You also need to take in the qeglfswindow patch2 from below:

    https://github.com/prabindh/qt-configs/tree/master/qt5_1_1_Sep13

    bq. >> Actually I was checking .. looks like even though it prints the error which i have reported for some time, but later i see that FPS saying that as per App, WebGL is working. But its not visible



  • Hi Prabindh,

    How are your eglfs patches licensed? Can they be used with the commercial version of QT? Or are your patches GPL only?

    Thanks in advance.



  • There is a Qt5 contributor agreement that I have to go through when I find some time. You might want to check with the Qt5 dev community on (1) the status of these patches if the agreement is not yet signed, and (2) does a patch apply concurrently on both commercial/LGPL or not.


  • Lifetime Qt Champion

    Hi,

    Since you have found a fix for these bugs, why not submit the patches ? Once they are approved they will be integrated so everybody can benefit from them


Log in to reply