# VTK rendering window doesn't display

**URL:** https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169
**Category:** Support
**Created:** [December 3, 2025, 7:43am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169 "2025-12-03T07:43:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Dakom](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dakom/32/10380_2.png) [@Dakom](https://discourse.vtk.org/u/Dakom)
#### Post date: [December 3, 2025, 7:43am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/1 "2025-12-03T07:43:15Z")

</div>

Hello dear VTK people,

I have recently tried installing VTK 9.5 on Ubuntu 24.04 from source (latest .tar.gz release) but when I compile **CylinderExample.cxx** (from the VTK examples) the window doesn’t show up. I would like my vtk installation to use my Nvidia RTX 3060Ti GPU.

I use this command to compile :

> g++ -g test.cpp -o test -I/usr/local/include/vtk-9.5 -L/usr/local/lib -lvtkCommonCore-9.5 -lvtkCommonDataModel-9.5 -lvtkCommonExecutionModel-9.5 -lvtkCommonColor-9.5 -lvtkFiltersSources-9.5 -lvtkRenderingCore-9.5 -lvtkRenderingOpenGL2-9.5 -lvtkRenderingFreeType-9.5 -lvtkRenderingUI-9.5 -lvtkInteractionStyle-9.5 -lvtkImagingCore-9.5 -lvtkIOImage-9.5 -lvtkjpeg-9.5 -lvtksys-9.5

I get no error, just nothing. Printing statements work if I add them though. I am also not experienced with building from source so this is what I did. I followed carefully the build.md of kitware ([https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/docs/build\_instructions/build.md](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/docs/build_instructions/build.md)).

For choosing the compile flag options I used the ninja “gui” generator making sure I allow OpenGL and basically leaving the default options, here is a bref summary of what seems important from the resulting CMakeCache.txt :

```auto
BUILD_SHARED_LIBS:BOOL=ON
VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=OFF
VTK_DEFAULT_RENDER_WINDOW_HEADLESS:BOOL=OFF
VTK_GROUP_ENABLE_Imaging:STRING=YES
VTK_GROUP_ENABLE_Qt:STRING=NO
VTK_GROUP_ENABLE_Rendering:STRING=YES
VTK_GROUP_ENABLE_STANDALONE:STRING=YES
VTK_GROUP_ENABLE_StandAlone:STRING=YES
VTK_GROUP_ENABLE_Views:STRING=YES
VTK_INSTALL_SDK:BOOL=ON
VTK_OPENGL_HAS_EGL:BOOL=OFF # didn't remember this one was off i'll retry with ON
VTK_OPENGL_USE_GLES:BOOL=OFF # i think it's for mobile dev
VTK_USE_CUDA:BOOL=OFF # I just want to use the GPU for rendering, nothing more
VTK_USE_X:BOOL=ON # i do have x11 and $DISPLAY -> :1
X11_X11_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libX11.so # some similar entries with 'PATH NOT FOUND' but no compile error so I guess it's ok

```

Additional notes that might be useful :

- running xeyes in the shell works.

- I am not on Wayland (tried Ubuntu and GNOME desktop)

- I tried some fiddling with Xauthority files

- After recompiling in Debug, gdb indicates these adresses for renderer, renderWindow : 0x5555555a38a0, 0x5555555a9d80.

- strace seems to show that every library he’s trying to use is found. I don’t see any error.

- typeid of renderWindow gives : 15vtkRenderWindow.

- I tried different build flags, some including VTK, Release mode, OPENGL\_HAS\_EGL without result.

- The python works fine and allows me to render images using my GPU (I can know thanks to nvidia-smi)

Thank you for your help 🙂

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [December 3, 2025, 7:45am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/2 "2025-12-03T07:45:54Z")

</div>

what does `renderWindow->Print(std::cout)` tells you ?

---

<div class="post-metadata">

### Author: ![Dakom](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dakom/32/10380_2.png) [@Dakom](https://discourse.vtk.org/u/Dakom)
#### Post date: [December 3, 2025, 7:51am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/3 "2025-12-03T07:51:03Z")

</div>

That was fast 😃

Here is the output requested :  
vtkRenderWindow (0x586d0a7a9d80)  
Debug: Off  
Modified Time: 388  
Reference Count: 2  
Registered Events: (none)  
Erase: On  
Window Name: Cylinder  
Position: (0, 0)  
Size: (300, 300)  
Mapped: 0  
**ShowWindow: 1**  
UseOffScreenBuffers: 0  
Double Buffered: 1  
DPI: 72  
TileScale: (1, 1)  
TileViewport: (0, 0, 1, 1)  
Borders: On  
Double Buffer: On  
Coverable: Off  
Full Screen: Off  
**Renderers:**  
Debug: Off  
Modified Time: 386  
Reference Count: 1  
Registered Events: (none)  
Number Of Items: 1  
Stereo Capable Window Requested: No  
Stereo Render: Off  
Point Smoothing: Off  
Line Smoothing: Off  
Polygon Smoothing: Off  
Abort Render: 0  
Current Cursor: 0  
Desired Update Rate: 0.0001  
In Abort Check: 0  
**NeverRendered: 1**  
Interactor: 0x586d0a7aa3e0  
Swap Buffers: On  
Stereo Type: RedBlue  
Number of Layers: 1  
AlphaBitPlanes: Off  
UseSRGBColorSpace: Off  
AnaglyphColorSaturation: 0.65  
AnaglyphColorMask: 4 , 3  
MultiSamples: 0  
StencilCapable: False  
PhysicalViewDirection: (0, 0, -1)  
PhysicalViewUp: (0, 1, 0)  
PhysicalTranslation: (0, 0, 0)  
PhysicalScale: 1

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [December 3, 2025, 7:54am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/4 "2025-12-03T07:54:24Z")

</div>

> [@Dakom](#):
>
> vtkRenderWindow (0x586d0a7a9d80)

This is unexpected, it should be either `vtkXOpenGLRenderWindow` or `vtkEGLRenderWindow`.

Can you try explicitely creating a `vtkXOpenGLRenderWindow` instead of a `vtkRenderWindow` ?

---

<div class="post-metadata">

### Author: ![Dakom](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dakom/32/10380_2.png) [@Dakom](https://discourse.vtk.org/u/Dakom)
#### Post date: [December 3, 2025, 7:58am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/5 "2025-12-03T07:58:14Z")

</div>

So I added

`#include <vtkXOpenGLRenderWindow.h>`

And replaced :

`vtkNew<vtkRenderWindow> renderWindow;`

With :

`vtkNew<vtkXOpenGLRenderWindow> renderWindow;`

And now finally I see a window !

Unfortunately it’s completely black.

Other changes :

Type of renderWindow: 22vtkXOpenGLRenderWindow  
vtkXOpenGLRenderWindow (0x5ba20faf2d40)

And I still have :

NeverRendered: 1

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [December 3, 2025, 7:58am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/6 "2025-12-03T07:58:45Z")

</div>

Something else must be going wrong, maybe @jaswantp has an idea.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [December 3, 2025, 12:36pm UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/7 "2025-12-03T12:36:35Z")

</div>

Try adding these lines to your `test.cpp`.

```c++
#include "vtkAutoInit.h"

VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkRenderingUI);
VTK_MODULE_INIT(vtkInteractionStyle);

```

When building with cmake, the module-level initialization of VTK’s class factories (for OpenGL etc) is automatic, but since you’re building without cmake, these extra lines of code are needed.

---

<div class="post-metadata">

### Author: ![Dakom](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dakom/32/10380_2.png) [@Dakom](https://discourse.vtk.org/u/Dakom)
#### Post date: [December 3, 2025, 8:50pm UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/8 "2025-12-03T20:50:30Z")

</div>

Thank you very much, this solved my issue. I wasn’t aware of those differences between ninja builds and cmake builds, good to know !

Is it still a good idea to keep that instruction :  
`ccmake -GNinja ../path/to/vtk/source`

in the [official setup guidelines](https://docs.vtk.org/en/latest/build_instructions/index.html) ?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [December 3, 2025, 9:28pm UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/9 "2025-12-03T21:28:32Z")

</div>

In your original post, you said you were running `g++` directly to build your program. That’s why `VTK_MODULE_INIT` is necessary.

It’s not about how VTK is built, it’s about how programs that _use_ VTK are built.

So in the end it’s not a cmake vs ninja thing, or about anything on the “official setup guidelines” for building VTK. The `ccmake -GNinja ../path/to/vtk/source` example is still the best way to build VTK.

---

<div class="post-metadata">

### Author: ![Dakom](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dakom/32/10380_2.png) [@Dakom](https://discourse.vtk.org/u/Dakom)
#### Post date: [December 4, 2025, 8:48am UTC](https://discourse.vtk.org/t/vtk-rendering-window-doesnt-display/16169/10 "2025-12-04T08:48:30Z")

</div>

Ah okay thank you for the clarification.

Have a nice day 🙂
