Browse Source

slightly more robust handling of CallbackGraphicsWindow

David Rose 14 years ago
parent
commit
fdca621619

+ 9 - 0
panda/src/display/callbackGraphicsWindow.cxx

@@ -230,6 +230,15 @@ bool CallbackGraphicsWindow::
 open_window() {
   // In this case, we assume the callback has handled the window
   // opening.
+
+  // We also assume the callback has given us an accurate
+  // FramebufferProperties, but we do go ahead and assume some certain
+  // minimum properties.
+  _fb_properties.set_rgb_color(1);
+
+  if (_fb_properties.get_color_bits() == 0) {
+    _fb_properties.set_color_bits(16);
+  }
   return true;
 }
 

+ 2 - 0
panda/src/display/graphicsEngine.cxx

@@ -416,6 +416,8 @@ make_output(GraphicsPipe *pipe,
       if ((precertify) && (gsg != 0) && (window->get_gsg()==gsg)) {
         do_add_window(window, threading_model);
         do_add_gsg(window->get_gsg(), pipe, threading_model);
+        display_cat.info()
+          << "Created output of type " << window->get_type() << "\n";
         return window;
       }
       do_add_window(window, threading_model);

+ 8 - 0
panda/src/display/graphicsOutput.cxx

@@ -937,6 +937,14 @@ make_texture_buffer(const string &name, int x_size, int y_size,
                 flags, get_gsg(), get_host());
 
   if (buffer != (GraphicsOutput *)NULL) {
+    if (buffer->get_gsg() == (GraphicsStateGuardian *)NULL || 
+        buffer->get_gsg()->get_prepared_objects() != get_gsg()->get_prepared_objects()) {
+      // If the newly-created buffer doesn't share texture objects
+      // with the current GSG, then we will have to force the texture
+      // copy to go through RAM.
+      to_ram = true;
+    }
+
     buffer->add_render_texture(tex, to_ram ? RTM_copy_ram : RTM_bind_or_copy);
     return buffer;
   }