isl-org / isl-org/Open3D

GLFW Error: GLX: Failed to make context current when using with ROS

Open
#4,661 3 comments 3 reactions 0 assignees View on GitHub
build/install visualization
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 have been trying to use open3d to visualize point clouds that are sent through a ROS node. As a subscriber node, it reads a point cloud, and just displays on open3d. I get this error 'GLFW Error: GLX: Failed to make context current when using with ROS'.

However, bizarrely, if I do not have the display function in the callback, and if I write a dummy function to just display a random point cloud, and call the function directly, it works. As soon as the display function is called within a subscriber callback component, I get this GLX error, which seems very weird. Here is a rough snippet.

```
class Visualizer:
def __init__(self):
self.vis = o3d.visualization.Visualizer()
rospy.Subscriber("/callbacktopic", String, self.callback)
rospy.spin()

def callback(self, data):
self.runner()

def self.runner(self):
pcd = o3d.geometry.PointCloud()
pcd.points = np.random.rand(10,3)
hull, _ = pcd.compute_convex_hull()
self.vis.add_geometry(hull)

```
This fails at the last step with the error in the title, but with a small change to the init function
```
def __init__(self):
self.vis = o3d.visualization.Visualizer()
self.runner()
```
This works, i.e. it is able to display a point cloud. This seems like a very weird error caused in open3d, and I'm not sure what the issue is.

If I use ```o3d.visualization.draw_geometries([pcd])``` it fails with a similar GLX error but not the same.

I have an NVidia MX330 graphics card. Interestingly, if I switch to intel graphics, the error goes away.

### Steps to reproduce the bug

```python
import numpy as np
import open3d

class Visualizer:
def __init__(self):
self.vis = o3d.visualization.Visualizer()
rospy.Subscriber("/callbacktopic", String, self.callback)
rospy.spin()

def callback(self, data):
self.runner()

def self.runner(self):
pcd = o3d.geometry.PointCloud()
pcd.points = np.random.rand(10,3)
hull, _ = pcd.compute_convex_hull()
self.vis.add_geometry(hull)
```

### Error message

_No response_

### Expected behavior

_No response_

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 18.04
- Python version: Python 2.7 (Since I need ROS)
- Open3D version: 0.9
- System type: x84
- Is this remote workstation?: no
- How did you install Open3D?: pip
- Compiler version gcc 7.5
```

### 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.