Important: Please read the Qt Code of Conduct -

Porting Qt application that uses QGLWidget to JavaScript

  • Hi there,

    I have an application that I want to port to JavaScript using Emscripten. The application is Qt-based and it uses QtCore, QtGui and QtOpenGL (namely the QGLWidget). QtCore and QtGui have already been ported to JavaScript with Emscripten, however QtOpenGL has not, which prevents me from porting my application.

    As such I have two options:

    • port QtOpenGL to JavaScript myself with Emscripten, which I would really like to avoid since it seems like overkill for what I'm trying to accomplish;

    • Replace the usage of QGLWidget in my application with just OpenGL code (since this gets translated to WebGL), alongside the rest of Qt code that my application uses for UI. However I haven't been able to create the GL context that would work with the Qt application. Is this even possible? I have seen this question seldom asked on various forums (i.e. have OpenGL code in the context of Qt, but without using QGLWidget), and the few times it's been asked it seems to always be discouraged in favor of using QGLWidget...

    Thanks in advance for your help!

Log in to reply