Skip to content

Commit

Permalink
Fix GLFW platform selection when re-initialized. GLFW remembers last …
Browse files Browse the repository at this point in the history
…null platform.
  • Loading branch information
ssheorey committed Jan 7, 2025
1 parent ef59ff4 commit 7fcdad4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 104 deletions.
14 changes: 8 additions & 6 deletions cpp/open3d/visualization/visualizer/Visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ class GLFWContext {
// framework build version of Python.
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE);
#endif
if (!(init_status_ = glfwInit())) {
init_status_ = glfwInit();
if (init_status_ != GLFW_TRUE) {
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL);
init_status_ = glfwInit();
if (init_status_ == GLFW_TRUE) {
init_status_ = GLFW_PLATFORM_NULL;
utility::LogWarning("GLFW initialized for headless rendering.");
}
}
if (init_status_ == GLFW_TRUE) init_status_ = glfwGetPlatform();
if (init_status_ == GLFW_PLATFORM_NULL) {
utility::LogWarning("GLFW initialized for headless rendering.");
}
}

Expand All @@ -51,11 +52,12 @@ class GLFWContext {
~GLFWContext() {
if (init_status_ != GLFW_FALSE) {
glfwTerminate();
init_status_ = GLFW_FALSE;
utility::LogDebug("GLFW destruct.");
}
}

/// \brief Get the glfwInit status.
/// \brief Get the glfwInit status / GLFW_PLATFORM initialized.
inline int InitStatus() const { return init_status_; }

/// \brief Get a shared instance of the GLFW context.
Expand Down
98 changes: 0 additions & 98 deletions docker/Dockerfile.docs

This file was deleted.

0 comments on commit 7fcdad4

Please sign in to comment.