Ver código fonte

gracefully handle NULL window

David Rose 22 anos atrás
pai
commit
bb3dd92452

+ 2 - 0
panda/src/framework/pandaFramework.cxx

@@ -261,6 +261,8 @@ open_window(const WindowProperties &props, GraphicsPipe *pipe,
   GraphicsWindow *win = wf->open_window(props, &_engine, pipe, gsg);
   if (win == (GraphicsWindow *)NULL) {
     // Oops, couldn't make an actual window.
+    framework_cat.error()
+      << "Unable to create window.\n";
     return NULL;
   }
 

+ 7 - 7
panda/src/framework/windowFramework.cxx

@@ -115,14 +115,14 @@ open_window(const WindowProperties &props, GraphicsEngine *engine,
   if (_window != (GraphicsWindow *)NULL) {
     _window->request_properties(props);
     set_background_type(_background_type);
-  }
-
-  // Set up a 3-d camera for the window by default.
-  make_camera();
 
-  if (show_frame_rate_meter) {
-    _frame_rate_meter = new FrameRateMeter("frame_rate_meter");
-    _frame_rate_meter->setup_layer(_window);
+    // Set up a 3-d camera for the window by default.
+    make_camera();
+    
+    if (show_frame_rate_meter) {
+      _frame_rate_meter = new FrameRateMeter("frame_rate_meter");
+      _frame_rate_meter->setup_layer(_window);
+    }
   }
 
   return _window;