# VTK using on wayland

**URL:** https://discourse.vtk.org/t/vtk-using-on-wayland/14848
**Category:** Development
**Tags:** code
**Created:** [November 11, 2024, 7:20am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848 "2024-11-11T07:20:53Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 11, 2024, 7:20am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/1 "2024-11-11T07:20:53Z")

</div>

Hello everyone,

I’m new to VTK and I’m encountering an issue when trying to render [CylinderExample](https://kitware.github.io/vtk-examples/site/Cxx/GeometricObjects/CylinderExample/)

my embedded environment is: wayland with EGL

so I rebuild VTK 9.1.0 source code with these options

1. VTK\_USE\_X=OFF
2. VTK\_OPENGL\_HAS\_EGL=ON
3. VTK\_OPENGL\_USE\_GLES=ON
4. VTK\_GROUP\_ENABLE\_Rendering=YES

but I got these error below:

```auto
2024-11-11 07:17:15.763 ( 0.043s) [8329A020] vtkOpenGLState.cxx:68 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2024-11-11 07:17:15.763 ( 0.044s) [8329A020] vtkOpenGLState.cxx:76 WARN| Error in cache state for GL_COLOR_WRITEMASK
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:83 WARN| Error in cache state for GL_BLEND
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:159 WARN| Error in cache state for GL_CULL_FACE_MODE
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:166 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:187 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:194 WARN| Error in cache state for GL_BLEND_DST_RGB
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:201 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2024-11-11 07:17:15.764 ( 0.044s) [8329A020] vtkOpenGLState.cxx:266 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2024-11-11 07:17:15.766 ( 0.046s) [8329A020] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff82483aa8 : ??? [(???) ???:-1]
0xffff82484418 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0xffff82c74e98 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c78438 : vtkOpenGLState::vtkglPixelStorei(unsigned int, int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c52b20 : vtkOpenGLRenderWindow::OpenGLInitState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c52c2c : vtkOpenGLRenderWindow::OpenGLInit() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82cf5284 : vtkEGLRenderWindow::Initialize() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c554fc : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82fd8818 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0xffff82c58978 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x402ab4 : ??? [(???) ???:-1]
0xffff824db230 : ??? [(???) ???:-1]
0xffff824db30c : __libc_start_main [(libc.so.6) ???:-1]
0x402170 : ??? [(???) ???:-1]

2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:76 WARN| Error in cache state for GL_COLOR_WRITEMASK
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:159 WARN| Error in cache state for GL_CULL_FACE_MODE
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:166 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:187 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2024-11-11 07:17:16.096 ( 0.376s) [8329A020] vtkOpenGLState.cxx:194 WARN| Error in cache state for GL_BLEND_DST_RGB
2024-11-11 07:17:16.096 ( 0.377s) [8329A020] vtkOpenGLState.cxx:201 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2024-11-11 07:17:16.096 ( 0.377s) [8329A020] vtkOpenGLState.cxx:208 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.096 ( 0.377s) [8329A020] vtkOpenGLState.cxx:215 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.096 ( 0.377s) [8329A020] vtkOpenGLState.cxx:266 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff82483aa8 : ??? [(???) ???:-1]
0xffff82484418 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0xffff82c74e98 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c78438 : vtkOpenGLState::vtkglPixelStorei(unsigned int, int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c52b40 : vtkOpenGLRenderWindow::OpenGLInitState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c52c2c : vtkOpenGLRenderWindow::OpenGLInit() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82cf5284 : vtkEGLRenderWindow::Initialize() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c554fc : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82fd8818 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0xffff82c58978 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x402ab4 : ??? [(???) ???:-1]
0xffff824db230 : ??? [(???) ???:-1]
0xffff824db30c : __libc_start_main [(libc.so.6) ???:-1]
0x402170 : ??? [(???) ???:-1]

2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:68 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:76 WARN| Error in cache state for GL_COLOR_WRITEMASK
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:83 WARN| Error in cache state for GL_BLEND
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:97 WARN| Error in cache state for GL_CULL_FACE
2024-11-11 07:17:16.098 ( 0.378s) [8329A020] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:120 WARN| Error in cache state for GL_STENCIL_TEST
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:159 WARN| Error in cache state for GL_CULL_FACE_MODE
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:166 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:187 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:194 WARN| Error in cache state for GL_BLEND_DST_RGB
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:201 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2024-11-11 07:17:16.430 ( 0.710s) [8329A020] vtkOpenGLState.cxx:208 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.430 ( 0.711s) [8329A020] vtkOpenGLState.cxx:215 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.430 ( 0.711s) [8329A020] vtkOpenGLState.cxx:252 WARN| Error in cache state for GL_READ_BUFFER
2024-11-11 07:17:16.430 ( 0.711s) [8329A020] vtkOpenGLState.cxx:266 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2024-11-11 07:17:16.431 ( 0.712s) [8329A020] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff82483aa8 : ??? [(???) ???:-1]
0xffff82484418 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0xffff82c74e98 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c778f4 : vtkOpenGLState::SetEnumState(unsigned int, bool) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c55410 : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82fd8818 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0xffff82c58978 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x402ab4 : ??? [(???) ???:-1]
0xffff824db230 : ??? [(???) ???:-1]
0xffff824db30c : __libc_start_main [(libc.so.6) ???:-1]
0x402170 : ??? [(???) ???:-1]

2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:68 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:76 WARN| Error in cache state for GL_COLOR_WRITEMASK
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:97 WARN| Error in cache state for GL_CULL_FACE
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:120 WARN| Error in cache state for GL_STENCIL_TEST
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2024-11-11 07:17:16.432 ( 0.712s) [8329A020] vtkOpenGLState.cxx:159 WARN| Error in cache state for GL_CULL_FACE_MODE
2024-11-11 07:17:16.763 ( 1.043s) [8329A020] vtkOpenGLState.cxx:166 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2024-11-11 07:17:16.763 ( 1.043s) [8329A020] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2024-11-11 07:17:16.763 ( 1.043s) [8329A020] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:187 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:194 WARN| Error in cache state for GL_BLEND_DST_RGB
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:201 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:208 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:215 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:252 WARN| Error in cache state for GL_READ_BUFFER
2024-11-11 07:17:16.763 ( 1.044s) [8329A020] vtkOpenGLState.cxx:266 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2024-11-11 07:17:16.764 ( 1.045s) [8329A020] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff82483aa8 : ??? [(???) ???:-1]
0xffff82484418 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0xffff82c74e98 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c76f80 : vtkOpenGLState::vtkglBlendFuncSeparate(unsigned int, unsigned int, unsigned int, unsigned int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c5543c : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82fd8818 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0xffff82c58978 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x402ab4 : ??? [(???) ???:-1]
0xffff824db230 : ??? [(???) ???:-1]
0xffff824db30c : __libc_start_main [(libc.so.6) ???:-1]
0x402170 : ??? [(???) ???:-1]

2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:68 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:76 WARN| Error in cache state for GL_COLOR_WRITEMASK
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:97 WARN| Error in cache state for GL_CULL_FACE
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:120 WARN| Error in cache state for GL_STENCIL_TEST
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:159 WARN| Error in cache state for GL_CULL_FACE_MODE
20[2014.837072] audit: type=1701 audit(1731309437.098:8): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=9427 comm="a.out" exe="/run/media/sda1/a.out" sig=6 res=1
24-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:166 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2024-11-11 07:17:16.765 ( 1.045s) [8329A020] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:187 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:194 WARN| Error in cache state for GL_BLEND_DST_RGB
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:201 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:208 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:215 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:252 WARN| Error in cache state for GL_READ_BUFFER
2024-11-11 07:17:17.097 ( 1.377s) [8329A020] vtkOpenGLState.cxx:266 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2024-11-11 07:17:17.098 ( 1.378s) [8329A020] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff82483aa8 : ??? [(???) ???:-1]
0xffff82484418 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0xffff82c74e98 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c75764 : vtkOpenGLState::vtkglBindFramebuffer(unsigned int, unsigned int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82bdffcc : vtkOpenGLFramebufferObject::PopulateFramebuffer(int, int, bool, int, int, bool, int, int, bool) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c54e08 : vtkOpenGLRenderWindow::CreateFramebuffers(int, int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82c55464 : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0xffff82fd8818 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0xffff82c58978 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x402ab4 : ??? [(???) ???:-1]
0xffff824db230 : ??? [(???) ???:-1]
0xffff824db30c : __libc_start_main [(libc.so.6) ???:-1]
0x402170 : ??? [(???) ???:-1]

2024-11-11 07:17:17.098 ( 1.379s) [8329A020] vtkOpenGLState.cxx:1795 WARN| Hardware does not support the number of textures defined.
a.out: /usr/src/debug/vtk/9.1.0-r0/VTK-9.1.0/Rendering/OpenGL2/vtkTextureObject.cxx:390: void vtkTextureObject::Bind(): Assertion `this->Handle' failed.
Aborted (core dumped)

```

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 13, 2024, 12:08am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/2 "2024-11-13T00:08:43Z")

</div>

Can you try vtk 9.4.0 instead with only `VTK_USE_X=OFF` option? [https://gitlab.kitware.com/vtk/vtk/-/tree/v9.4.0.rc3?ref\_type=tags](https://gitlab.kitware.com/vtk/vtk/-/tree/v9.4.0.rc3?ref_type=tags)

What GPU is used in your environment? Can you run [eglinfo](https://github.com/dv1/eglinfo) successfully and show the output?

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 13, 2024, 1:26am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/3 "2024-11-13T01:26:14Z")

</div>

@jaswantp my system is [am62xx](https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_03_00_19/exports/docs/linux/Foundational_Components/Graphics/Graphics_and_Display.html) SoC

```auto
root@am62xx-evm:/usr/lib# eglinfo
EGL client extensions string:
    EGL_EXT_client_extensions EGL_EXT_device_base
    EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base
    EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug
    EGL_EXT_platform_device EGL_EXT_platform_wayland
    EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11
    EGL_EXT_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm
    EGL_MESA_platform_surfaceless

GBM platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL_ES
EGL extensions string:
    EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age
    EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import
    EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_image_gl_colorspace
    EGL_EXT_yuv_surface EGL_IMG_context_priority EGL_KHR_cl_event2
    EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync
    EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace
    EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image
    EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image
    EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap
    EGL_KHR_no_config_context EGL_KHR_partial_update
    EGL_KHR_reusable_sync EGL_KHR_surfaceless_context
    EGL_EXT_pixel_format_float EGL_KHR_wait_sync
    EGL_MESA_configless_context EGL_MESA_drm_image
    EGL_MESA_image_dma_buf_export EGL_MESA_query_driver
    EGL_WL_bind_wayland_display EGL_IMG_cl_image
Configurations:
     bf lv colorbuffer dp st ms vis cav bi renderable supported
  id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces
---------------------------------------------------------------------
0x01 32 0 8 8 8 8 0 0 0 0 0x34325241-- a y y win,pb
0x02 32 0 8 8 8 8 0 0 2 1 0x34325241-- a y y win,pb
0x03 32 0 8 8 8 8 0 0 4 1 0x34325241-- a y y win,pb
0x04 32 0 8 8 8 8 24 8 0 0 0x34325241-- a y y win,pb
0x05 32 0 8 8 8 8 24 8 2 1 0x34325241-- a y y win,pb
0x06 32 0 8 8 8 8 24 8 4 1 0x34325241-- a y y win,pb
0x07 24 0 8 8 8 0 0 0 0 0 0x34325258-- y y y win,pb
0x08 24 0 8 8 8 0 0 0 2 1 0x34325258-- y y y win,pb
0x09 24 0 8 8 8 0 0 0 4 1 0x34325258-- y y y win,pb
0x0a 24 0 8 8 8 0 24 8 0 0 0x34325258-- y y y win,pb
0x0b 24 0 8 8 8 0 24 8 2 1 0x34325258-- y y y win,pb
0x0c 24 0 8 8 8 0 24 8 4 1 0x34325258-- y y y win,pb
0x0d 16 0 5 6 5 0 0 0 0 0 0x36314752-- y y y win,pb
0x0e 16 0 5 6 5 0 0 0 2 1 0x36314752-- y y y win,pb
0x0f 16 0 5 6 5 0 0 0 4 1 0x36314752-- y y y win,pb
0x10 16 0 5 6 5 0 24 8 0 0 0x36314752-- y y y win,pb
0x11 16 0 5 6 5 0 24 8 2 1 0x36314752-- y y y win,pb
0x12 16 0 5 6 5 0 24 8 4 1 0x36314752-- y y y win,pb

Wayland platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL_ES
EGL extensions string:
    EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age
    EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import
    EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_image_gl_colorspace
    EGL_EXT_present_opaque EGL_EXT_swap_buffers_with_damage
    EGL_EXT_yuv_surface EGL_IMG_context_priority EGL_KHR_cl_event2
    EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync
    EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace
    EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image
    EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image
    EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_partial_update
    EGL_KHR_reusable_sync EGL_KHR_surfaceless_context
    EGL_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float
    EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image
    EGL_MESA_image_dma_buf_export EGL_MESA_query_driver
    EGL_WL_bind_wayland_display EGL_WL_create_wayland_buffer_from_image
    EGL_IMG_cl_image
Configurations:
     bf lv colorbuffer dp st ms vis cav bi renderable supported
  id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces
---------------------------------------------------------------------
0x01 32 0 8 8 8 8 0 0 0 0 0x00-- a y y win,pb
0x02 32 0 8 8 8 8 0 0 2 1 0x00-- a y y win,pb
0x03 32 0 8 8 8 8 0 0 4 1 0x00-- a y y win,pb
0x04 32 0 8 8 8 8 24 8 0 0 0x00-- a y y win,pb
0x05 32 0 8 8 8 8 24 8 2 1 0x00-- a y y win,pb
0x06 32 0 8 8 8 8 24 8 4 1 0x00-- a y y win,pb
0x07 24 0 8 8 8 0 0 0 0 0 0x00-- y y y win,pb
0x08 24 0 8 8 8 0 0 0 2 1 0x00-- y y y win,pb
0x09 24 0 8 8 8 0 0 0 4 1 0x00-- y y y win,pb
0x0a 24 0 8 8 8 0 24 8 0 0 0x00-- y y y win,pb
0x0b 24 0 8 8 8 0 24 8 2 1 0x00-- y y y win,pb
0x0c 24 0 8 8 8 0 24 8 4 1 0x00-- y y y win,pb
0x0d 16 0 5 6 5 0 0 0 0 0 0x00-- y y y win,pb
0x0e 16 0 5 6 5 0 0 0 2 1 0x00-- y y y win,pb
0x0f 16 0 5 6 5 0 0 0 4 1 0x00-- y y y win,pb
0x10 16 0 5 6 5 0 24 8 0 0 0x00-- y y y win,pb
0x11 16 0 5 6 5 0 24 8 2 1 0x00-- y y y win,pb
0x12 16 0 5 6 5 0 24 8 4 1 0x00-- y y y win,pb
0x13 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x14 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x15 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x16 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x17 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x18 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x19 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x1a 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x1b 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x1c 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x1d 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x1e 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x1f 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x20 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x21 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x22 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x23 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x24 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x25 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x26 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x27 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x28 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x29 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x2a 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x2b 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x2c 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x2d 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x2e 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x2f 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x30 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x31 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x32 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x33 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x34 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x35 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x36 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x37 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x38 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x39 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x3a 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x3b 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x3c 8 0 0 0 0 0 24 8 4 1 0x00-- win
0x3d 8 0 0 0 0 0 0 0 0 0 0x00-- win
0x3e 8 0 0 0 0 0 0 0 2 1 0x00-- win
0x3f 8 0 0 0 0 0 0 0 4 1 0x00-- win
0x40 8 0 0 0 0 0 24 8 0 0 0x00-- win
0x41 8 0 0 0 0 0 24 8 2 1 0x00-- win
0x42 8 0 0 0 0 0 24 8 4 1 0x00-- win

X11 platform:
eglinfo: eglInitialize failed

Device platform:
eglinfo: eglInitialize failed

```

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 15, 2024, 8:47am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/4 "2024-11-15T08:47:33Z")

</div>

@jaswantp I have a question!!

Does VTK only support offscreen rendering with the option `VTK_OPENGL_HAS_EGL=ON` ?  
which means if my system only have EGL, I can only get the “static images” not the “interactive windows”?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 15, 2024, 12:41pm UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/5 "2024-11-15T12:41:39Z")

</div>

> [@CHENG-HSUAN](#):
>
> which means if my system only have EGL, I can only get the “static images” not the “interactive windows”?

The VTK EGL integration supports interactive windows only on Android. On all other platforms, it renders to an offscreen buffer. Although, the implementation can be updated to do onscreen rendering with EGL on desktop. It is actually quite simple to do it. So far, there has been no interest from our existing customers. If you’d like this feature in VTK, don’t hesitate to [contact Kitware](https://www.kitware.com/contact/project/) to get it done!

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 18, 2024, 2:05am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/6 "2024-11-18T02:05:39Z")

</div>

> [@jaswantp](#):
>
> It is actually quite simple to do it

@jaswantp No wonder!!

I did a simple test.

1. Set Ubuntu 22.04 to use wayland

2. downloaded the VTK 9.1.0 source code and built it with the `VTK_USE_X=OFF` and `VTK_OPENGL_HAS_EGL=ON` options ( I believe the `apt install vtk9` package is built with `VTK_USE_X=ON` and `VTK_OPENGL_HAS_EGL=OFF` options )

3. Built a modified version of the [Cylinder Example](https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder/), adding the following module initialization lines to the code:

4. Finally, ran the `Cylinder` program, but it exited immediately **without** stopping at `renderWindowInteractor->Start()` and showing an interactive window. 😂

The above is just the testing scenario. However, my actual environment is a Wayland-based system running on an AM62xx SoC ( which might not be recognized as Android ). What workarounds can I use to make this work?

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 18, 2024, 11:58am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/7 "2024-11-18T11:58:12Z")

</div>

> [@jaswantp](#):
>
> Can you try vtk 9.4.0 instead with only `VTK_USE_X=OFF` option?

@jaswantp First of all, thanks for your help!!

I’m still conducting the simple test on Ubuntu 22.04 in Wayland mode. When I followed your suggestion (using v9.4.0.rc3), I encountered the same result:

Running the `Cylinder` program results in an immediate exit **without** stopping at `renderWindowInteractor->Start()` or displaying an interactive window.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 18, 2024, 12:59pm UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/8 "2024-11-18T12:59:57Z")

</div>

VTK doesn’t support wayland like that.

Instead, you can install `xwayland` and run VTK using X interactors.

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 19, 2024, 1:50am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/9 "2024-11-19T01:50:09Z")

</div>

> [@jaswantp](#):
>
> Although, the implementation can be updated to do onscreen rendering with EGL on desktop. It is actually quite simple to do it.

@jaswantp How to do that, I want to do a simple feasibility analysis, because my environment cannot use GLX or anything X related

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 20, 2024, 9:00am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/10 "2024-11-20T09:00:26Z")

</div>

We would like to thank @jaswantp for the help.

Our company’s products heavily rely on VTK. We are very interested in this feature. If you could provide what you refer to as a simple implementation for “on-screen rendering with EGL,” it would be greatly appreciated.

It doesn’t need to be fully complete; just a feasible implementation will suffice. Our company will then propose a collaboration with Kitware.

---

<div class="post-metadata">

### Author: ![CHENG-HSUAN](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@CHENG-HSUAN](https://discourse.vtk.org/u/CHENG-HSUAN)
#### Post date: [November 20, 2024, 9:08am UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/11 "2024-11-20T09:08:51Z")

</div>

[EGL\_GLES.patch](https://discourse.vtk.org/uploads/short-url/a4wepbWfvsXp9oE32hKYrSVwH7c.patch) (3.5 KB)  
This is my initial modification, but it didn’t work.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 20, 2024, 1:52pm UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/12 "2024-11-20T13:52:27Z")

</div>

FYI, @cory.quammen

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 20, 2024, 2:46pm UTC](https://discourse.vtk.org/t/vtk-using-on-wayland/14848/13 "2024-11-20T14:46:33Z")

</div>

> [@CHENG-HSUAN](#):
>
> It doesn’t need to be fully complete; just a feasible implementation will suffice. Our company will then propose a collaboration with Kitware.

Hi @CHENG-HSUAN

While I understand your request and concerns, a partial implementation is not the correct approach because there are many moving parts here. As you have found out with your patch, the current `vtkEGLRenderWindow` won’t work with wayland since it does not have mechanism to use a wayland surface object which is required to correctly invoke `eglCreateWindowSurface`. In principle, this could be an X display/Wayland surface/Win32 HDC. The main area that needs work is to adapt `vtkEGLRenderWindow` to initialize from native window handles.

From my understanding, it looks like your broader objective is to get VTK applications to use native wayland (not xwayland/X). In this case, I propose extending the `vtkEGLRenderWindow` for onscreen rendering. There are two items that need worked on:

1. Adapt the `vtkEGLRenderWindow` to initialize EGL context using a wayland surface. Basic samples here - [EGL with Wayland](https://jan.newmarch.name/Wayland/EGL) give an idea of the API this class will use.
2. Create a new `vtkWaylandRenderWindowInteractor` for user interaction on wayland. There is no VTK interactor for wayland. The `Cylinder` example program exited immediately because the default interactor was in use whose `Start()` method doesn’t do anything.

In case you want to play with something and get it to render onscreen for wayland without interaction, add these lines before you call `eglCreateWindowSurface`. This code is not tested and you will need to do some refactoring, like move the handlers in an internals class and declare the new member variables in the `vtkInternals` class. I mostly cribbed the code from other wayland-egl samples. Think of it as a teaser on the necessary plumbing.

```c++
  // Define static handler functions in global namespace and remove static.
  static void global_registry_handler(
    void* data, struct wl_registry* registry, uint32_t id, const char* interface, uint32_t version)
  {
    printf("Got a registry event for %s id %d\n", interface, id);
    if (strcmp(interface, "wl_compositor") == 0)
    {
      compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
    }
    else if (strcmp(interface, "wl_shell") == 0)
    {
      shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
    }
  }

  static void global_registry_remover(void* data, struct wl_registry* registry, uint32_t id)
  {
    printf("Got a registry losing event for %d\n", id);
  }

  static const struct wl_registry_listener registry_listener = { global_registry_handler,
    global_registry_remover };
  // Init the NativeDisplay and Display before eglInitialize.
  impl->NativeWaylandDisplay = wl_display_connect(NULL);
  if (impl->NativeWaylandDisplay == NULL)
  {
    fprintf(stderr, "Can't connect to display\n");
    exit(1);
  }
  impl->Display = eglGetDisplay((EGLNativeDisplayType)impl->NativeWaylandDisplay);

  struct wl_registry* registry = wl_display_get_registry(impl->NativeWaylandDisplay);
  wl_registry_add_listener(registry, &registry_listener, NULL);

  wl_display_dispatch(impl->NativeWaylandDisplay);
  wl_display_roundtrip(impl->NativeWaylandDisplay);

  if (impl->WaylandCompositor == NULL || impl->WaylandShell == NULL)
  {
    fprintf(stderr, "Can't find compositor or shell\n");
    exit(1);
  }
  else
  {
    fprintf(stderr, "Found compositor and shell\n");
  }
  impl->WaylandSurface = wl_compositor_create_surface(impl->WaylandCompositor);
  if (impl->WaylandSurface == NULL)
  {
    fprintf(stderr, "Can't create surface\n");
    exit(1);
  }
  else
  {
    fprintf(stderr, "Created surface\n");
  }

  impl->WaylandShellSurface = wl_shell_get_shell_surface(impl->WaylandShell, surface);
  wl_shell_surface_set_toplevel(impl->WaylandShellSurface);
  impl->Window = wl_egl_window_create(impl->Surface, this->Size[0], this->Size[1]);

  if (impl->Window == EGL_NO_SURFACE)
  {
    fprintf(stderr, "Can't create egl window\n");
    exit(1);
  }
  else
  {
    fprintf(stderr, "Created egl window\n");
  }

```
