Is it possible to build vtkGuiSupportQt in webassembly?

I try to build vtk with qt in webassembly, this is my build command
*************** begain of command *************
emcmake cmake …\vtk-v9.1.0 -G “MinGW Makefiles” -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_PREFIX_PATH=D:/Qt2/Qt6.4.0/6.4.3/wasm_32 -DCMAKE_TOOLCHAIN_FILE=D:/Qt2/Qt6.4.0/6.4.3/wasm_32/lib/cmake/Qt6/qt.toolchain.cmake -DVTK_ENABLE_LOGGING:BOOL=OFF -DQt6Core_DIR:PATH=D:/Qt2/Qt6.4.0/6.4.3/wasm_32/lib/cmake/Qt6Core -DQt6OpenGL_DIR:PATH=D:/Qt2/Qt6.4.0/6.4.3/wasm_32/lib/cmake/Qt6OpenGL -DVTK_GROUP_ENABLE_Qt:STRING=YES -DVTK_QT_VERSION=6 -DQt6_DIR:PATH=D:/Qt2/Qt6.4.0/6.4.3/wasm_32/lib/cmake/Qt6 -DVTK_ENABLE_WRAPPING:BOOL=OFF -DVTK_LEGACY_REMOVE:BOOL=ON -DVTK_OPENGL_USE_GLES:BOOL=ON -DVTK_USE_SDL2:BOOL=ON -DVTK_NO_PLATFORM_SOCKETS:BOOL=ON -DVTK_MODULE_ENABLE_VTK_hdf5:STRING=NO -DOPENGL_INCLUDE_DIR:PATH=D:\myLibs\Emscripten\Install\emsdk\upstream\emscripten\system\include -DVTK_MODULE_ENABLE_VTK_RenderingContext2D=DONT_WANT -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=DONT_WANT -DOPENGL_EGL_INCLUDE_DIR:PATH=D:\myLibs\Emscripten\Install\emsdk\upstream\emscripten\system\include -DOPENGL_GLES2_INCLUDE_DIR:PATH=D:\myLibs\Emscripten\Install\emsdk\upstream\emscripten\system\include -DOPENGL_GLES3_INCLUDE_DIR:PATH=D:\myLibs\Emscripten\Install\emsdk\upstream\emscripten\system\include -DVTK_OPENGL_USE_GLES=ON -DCMAKE_INSTALL_PREFIX:PATH=D:\myLibs\VTK\vtk-v9.1.0-wasm3.1.14-qt6-install
********* end of command ***********

Here is my problem:
when it come to vtkGuiSupportQt, it generate errors:

D:\myLibs\VTK\vtk-v9.1.0\GUISupport\Qt\QVTKOpenGLWindow.cxx:266:43: error: use of undeclared identifier ‘GL_BACK_LEFT’
this->defaultFramebufferObject(), GL_BACK_LEFT, QRect(QPoint(0, 0), deviceSize));
^
D:\myLibs\VTK\vtk-v9.1.0\GUISupport\Qt\QVTKOpenGLWindow.cxx:268:43: error: use of undeclared identifier ‘GL_BACK_RIGHT’
this->defaultFramebufferObject(), GL_BACK_RIGHT, QRect(QPoint(0, 0), deviceSize));
^
D:\myLibs\VTK\vtk-v9.1.0\GUISupport\Qt\QVTKOpenGLWindow.cxx:273:43: error: use of undeclared identifier ‘GL_BACK_LEFT’
this->defaultFramebufferObject(), GL_BACK_LEFT, QRect(QPoint(0, 0), deviceSize));

It seems missing GL.h header file.
I’m not sure how to solve this, does any one meet this error? or have some advice?
Thank you in advance!

The QVTKOpenGLWindow class uses some OpenGL functionality that’s incompatible with WebGL2.

Hi @wh0395,
Did you use vtkSDL2OPenGLRenderWindow?
I am also working on a project involving vtk wasm.
So I would like to share some problems with you

Hi @Miranda

yes, I’m using vtkSDL2OPenGLRenderWindow for now, it works fine.
But it seems I have to use other framework for GUI part on web. like vue or react.
And I’m not familiar with vue or react :worried:

ok i think you are right

don’t worry,
I can help with GUI development with vue or react anytime

please post the issues

ok, thank you for your willing to support!