-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glfwTerminate() called in the Visualizer destructor #4960
Comments
I just made a test where I remove that
I'll open a PR as soon as my other one is merged. |
|
With my PR and this code, everything is fine: import time
import numpy as np
import open3d as o3d
o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Debug)
sample_data = o3d.data.DemoCustomVisualization()
# Read Pointcloud
pcd = o3d.io.read_point_cloud(sample_data.point_cloud_path)
for i in range(3):
# Create Visualizer
vis = o3d.visualization.Visualizer()
vis.create_window(width=960, height=540, visible=True)
vis.add_geometry(pcd)
# View Control
ctr = vis.get_view_control()
ctr.set_front([0,1,0])
ctr.set_up([0,0,1])
ctr.set_zoom(1.5)
# Updates
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
# Capture image
time.sleep(1)
image = np.array(vis.capture_screen_float_buffer())
assert np.amin(image) < np.amax(image)
# WARNING: this is still needed, unsure why
del ctr
del vis Output:
With the visualizer outside the loop, it's fine too: import time
import numpy as np
import open3d as o3d
o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Debug)
sample_data = o3d.data.DemoCustomVisualization()
# Read Pointcloud
pcd = o3d.io.read_point_cloud(sample_data.point_cloud_path)
# Create Visualizer
vis = o3d.visualization.Visualizer()
vis.create_window(width=960, height=540, visible=True)
vis.add_geometry(pcd)
for i in range(3):
# View Control
ctr = vis.get_view_control()
ctr.set_front([0,1,0])
ctr.set_up([0,0,1])
ctr.set_zoom(1.5)
# Updates
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
# Capture image
time.sleep(1)
image = np.array(vis.capture_screen_float_buffer())
assert np.amin(image) < np.amax(image)
del ctr
del vis Output:
|
thanks for your work, after adding
,my loop can work. |
…(See PR #4963) [Author: @bchretien] (#6559) * examples: fix headless_rendering.py * ViewControl.cpp: relax floating-point comparison in ConvertFromPinholeCameraParameters() * Visualizer: improve GLTF context handling (fix #4960) --------- Authored-by: Benjamin Chrétien <[email protected]>
Checklist
master
branch).Describe the issue
While testing headless rendering, I got rendering issues with a lot of warnings like this one:
This has been brought up in some other issues (e.g. #599, #2006, #3489), but apparently the root cause has not been addressed. After looking at the code, I've seen that
glfwTerminate()
is called in a singleton handling initialization/deinitialization of GLFW (as expected), but also inVisualizer
's destructor (see here), which I don't understand. The official documentation of that function is clear:So why is that terminate call needed here?
Steps to reproduce the bug
Error message
Expected behavior
We should be able to create and destroy
Visualizer
without breaking GLFW.Open3D, Python and System information
Additional information
No response
The text was updated successfully, but these errors were encountered: