isl-org / isl-org/Open3D

`destroy_window()` gets stuck when geometry is added when running in headless mode

Open
#6,527 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

I've compiled open3d from source for headless rendering, I have done this via:

```
git clone https://github.com/isl-org/Open3D.git && \
cd Open3D && \
git checkout 7c0acac0a50293c52d2adb70967e729f98fa5018 && \
mkdir build && \
cd build && \
cmake -DENABLE_HEADLESS_RENDERING=ON \
-DBUILD_GUI=OFF \
-DBUILD_WEBRTC=OFF \
-DUSE_SYSTEM_GLEW=OFF \
-DUSE_SYSTEM_GLFW=OFF \
.. && \
make -j$(nproc) && \
make install-pip-package
```

The issue that I'm facing is I can't close the window when geometry is added. For a minimal reproducible script try below

The file I've used is (you'll have to unzip it):
[points.ply.zip](https://github.com/isl-org/Open3D/files/13582958/points.ply.zip)

I've tested it with other files & geometry, but it also doesn't work.

### Steps to reproduce the bug

```python
print("Creating first window")
vis = o3d.visualization.Visualizer()
pcd = o3d.io.read_point_cloud(str(Path(__file__).parent / "points.ply"))
vis.create_window("rendering", width=1024, height=768)

index = 0
def move_forward(vis):
nonlocal index
if index < 10:
index += 1
print(index)
else:
print("Deregistering animation callback")
vis.register_animation_callback(None)
print("Destroying window")
vis.destroy_window()
print("Window destroyed")
return False

vis.register_animation_callback(move_forward)
vis.run()
print("First window animation finished")

print("Creating second window")
vis = o3d.visualization.Visualizer()
vis.create_window("rendering", width=1024, height=768)
vis.add_geometry(pcd)

index = 0
def move_forward(vis):
nonlocal index
if index < 10:
index += 1
print(index)
else:
print("Deregistering animation callback")
vis.register_animation_callback(None)
print("Destroying window")
vis.destroy_window()
print("Window destroyed")
return False

vis.register_animation_callback(move_forward)
vis.run()
print("Second window animation finished")
```

### Error message

_No response_

### Expected behavior

_No response_

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.9.15
- Open3D version: '0.17.0+7c0acac0a'
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: build from source
- Compiler version (if built from source): gcc 10.4.0
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.