1

VenomousByte 4 minutes ago

Hi, absolute newbe to this forum so please forgive (and tell) me if I'm doing somthing terribly wrong.

I'm looking to port a Qt-application to WebAssembly but am stuck. The application allows the user to "fly" through 3D space using a first person type camera. The issue here is, that the Qt3DRenderer::QCamera is used to facilitate this movement, but does not seem to be supported by WebAssembly.

The question I now have is: am I just out of luck and it can't be done, or is there some alternative for a first person camera with free 3D movement that is supported by WebAssembly?

This is how I create the *.pro file (and add some include directories):

@echo off

set QT_DIR=C:\...

START /WAIT %QT_DIR%\wasm_32\bin\qmake -project

ECHO # Additional Include Paths >> .\app.pro
ECHO INCLUDEPATH += .\..\.. >> .\app.pro
ECHO INCLUDEPATH += %QT_DIR%\wasm_32\include\QtWidgets >> .\app.pro
ECHO INCLUDEPATH += %QT_DIR%\wasm_32\include\QtMultimedia >> .\app.pro
ECHO # Define Cpp Version >> .\app.pro
ECHO CONFIG += c++1z >> .\app.pro
ECHO # Suppress Warnings >> .\app.pro
ECHO CONFIG += warn_off >> .\app.pro

This is how I try to compile the whole thing into WebAssembly:

set QT_DIR=C:\...
set VS_COMPILER_TOOLS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\..."

set PATH=%VS_COMPILER_TOOLS_PATH%\cl.exe;%PATH%

call E:\pcr\emsdk\emsdk.bat activate
START /WAIT %QT_DIR%\msvc2017_64\bin\uic app.ui -o ui_app.h
START /WAIT %QT_DIR%\wasm_32\bin\qmake
make

And these are the error messages ... ... without adding %QT_DIR%\msvc2017_64\include as include location to the project file:

..\..\tools/app/apprenderwidget.h:19:10: fatal error: 'Qt3DRender/QCamera' file not found

... after adding %QT_DIR%\msvc2017_64\include as include location to the project file: (basically a bunch of undefined symbol errors, which include but are not limited to the QCamera functions)

...
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
...
error: undefined symbol: _ZN10Qt3DRender7QCamera11setPositionERK9QVector3D
error: undefined symbol: _ZN10Qt3DRender7QCamera11setUpVectorERK9QVector3D
error: undefined symbol: _ZN10Qt3DRender7QCamera13setViewCenterERK9QVector3D
error: undefined symbol: _ZN10Qt3DRender7QCamera3panEfRK9QVector3D
error: undefined symbol: _ZN10Qt3DRender7QCamera4tiltEf
error: undefined symbol: _ZN10Qt3DRender7QCamera9translateERK9QVector3DNS0_23CameraTranslationOptionE
error: undefined symbol: _ZN10Qt3DRender7QCameraC1EPN8Qt3DCore5QNodeE
error: undefined symbol: _ZN10Qt3DRender7QCameraD1Ev
...
  • Can you check your Qt WASM kits configuration? Maybe it simply wasnt compiled with **QT += 3drender** ? – markus-nm Jan 22 '20 at 13:43
  • WASM was simply installed using the QT Maintenance Tool (since I figured it would be less of a pain than compiling it myself). It does not provide any 3D related include directories, so that might be the issue? Will check the configuration once I’m back at my work-desktop. – VenomousByte Jan 22 '20 at 14:27
  • I guess you'll have to recompile QT for WASM with all the 3d rendering classes. It should all work, in theory, as Qt for WASM still renders with opengl. Yet there are no 3D examples available, so, err good luck! – markus-nm Jan 22 '20 at 14:38
  • Thanks, will do/try and update this question accordingly (since I couldn’t find any question like it, so might as well help out others with the same issue) – VenomousByte Jan 22 '20 at 15:50

1 Answers1

0

Qt3D is not supported yet by Qt WebAssembly, so it will not work with the binary install you get from the maintenance app.

You would need to configure Qt yourself with the -feature-thread argument. You will also need emscripten version greater than 1.38.30.

Qt3d requires opengl (desktop) which Qt WebAssembly does not support, only opengl es2 and opengl es3.

  • Any news on QT3d support from Qt WebAssembly ? did something changed in Qt6 ? From this page: https://doc-snapshots.qt.io/qt6-dev/wasm.html it looks like there is still no support for QT3d for the reason you mentionned. – Tobbey Sep 28 '21 at 13:08