build VTK-9.1.0 to webassembly

Hello,
Nice to update to VTK-9.1.0 on Windows11 .

But when I compile it via dockcross/web-wasm:20220202, it raise error like below :wink:

/VTK-9.1.0/Rendering/ContextOpenGL2/vtkOpenGLContextBufferId.cxx:142:21: error: use of undeclared identifier ‘GL_DRAW_BUFFER’
glGetIntegerv(GL_DRAW_BUFFER, &savedDrawBuffer);


the cmake command is :
cmake
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=Release
-DVTK_ENABLE_LOGGING:BOOL=OFF
-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
…/…/apps/VTK-9.1.0 && cmake --build .

sometimes I use ninja -j 16 and the error is the same.

Any reply will be very appreciated ! Thanks in advance!
William

I think we just haven’t used the context toolkit in webasm yet. It probably needs to be ifdef’d out and when ifdef’d out always assume GL_BACK_LEFT

e.g. something like

    GLint attachment = GL_BACK_LEFT;
#ifdef GL_DRAW_BUFFER
    glGetIntegerv(GL_DRAW_BUFFER, &attachment);
#endif

etc

Many Thanks !
I have resolved this by set OPENGL=DONT_WANT . :slight_smile:

Could you show me how to add OPENGL=DONT_WANT ?
I add -DVTK_MODULE_ENABLE_VTK_opengl:STRING=DONT_WANT , but still has the same error.

@reichtiger

@Sebastien_Jourdain I used ccmake and set OPENGL_GLES2_INCLUDE_DIR and OPENGL_GLES3_INCLUDE_DIR with a absolute path

 /Users/andaji/Mine/GithubCodes/emsdk/upstream/emscripten/system/include,

but still has the error.

:cold_sweat: I’m sorry that, because new users are temporarily limited to 3 replies in the same topic. So I edit this to reply you.

Use ccmake to prevent guess work on the command line.