Skip to content

Commit

Permalink
Merge pull request #1420 from dorodnic/glfw_create_window_fix
Browse files Browse the repository at this point in the history
Adding protection against missing OpenGL drivers
  • Loading branch information
dorodnic authored Mar 22, 2018
2 parents 48294a7 + aa3b729 commit 058d5b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/ux-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ namespace rs2
// Create GUI Windows
_win = glfwCreateWindow(_width, _height, _title_str.c_str(),
(_fullscreen ? primary : nullptr), nullptr);
if (!_win)
throw std::runtime_error("Could not open OpenGL window, please check your graphic drivers or use the textual SDK tools");

glfwMakeContextCurrent(_win);
ImGui_ImplGlfw_Init(_win, true);

Expand Down
2 changes: 2 additions & 0 deletions examples/example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class window
{
glfwInit();
win = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (!win)
throw std::runtime_error("Could not open OpenGL window, please check your graphic drivers or use the textual SDK tools");
glfwMakeContextCurrent(win);

glfwSetWindowUserPointer(win, this);
Expand Down
2 changes: 2 additions & 0 deletions tools/rosbag-inspector/rs-rosbag-inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class gui_window
_first_frame(true),
_w(0), _h(0)
{
if (!_window)
throw std::runtime_error("Could not open OpenGL window, please check your graphic drivers");
init_window();
}
operator bool()
Expand Down

0 comments on commit 058d5b5

Please sign in to comment.