Browse Source

fix Tut-Fireflies demo (problem with initially zero-sized buffers)

David Rose 14 years ago
parent
commit
841bfb0743

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

@@ -444,6 +444,7 @@ make_output(GraphicsPipe *pipe,
       } else {
         display_cat.info()
           << window->get_type() << " wouldn't open; abandoning.\n";
+        cerr << window->get_fb_properties() << "\n";
       }
 
       // No good; delete the window and keep trying.

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

@@ -98,6 +98,12 @@ GraphicsOutput(GraphicsEngine *engine, GraphicsPipe *pipe,
     _y_size = win_prop.get_y_size();
     _is_nonzero_size = (_x_size > 0 && _y_size > 0);
   }
+  if (_creation_flags & GraphicsPipe::BF_size_track_host) {
+    // If we're tracking the host size, we assume we'll be nonzero
+    // eventually.
+    _is_nonzero_size = true;
+  }
+
   _is_valid = false;
   _flip_ready = false;
   _cube_map_index = -1;

+ 8 - 1
panda/src/glstuff/glGraphicsBuffer_src.cxx

@@ -157,7 +157,14 @@ begin_frame(FrameMode mode, Thread *current_thread) {
         _needs_rebuild = true;
       }
     }
-
+    if (_creation_flags & GraphicsPipe::BF_size_track_host) {
+      if ((_host->get_x_size() != _x_size)||
+          (_host->get_y_size() != _y_size)) {
+        // We also need to rebuild if we need to change size.
+        _needs_rebuild = true;
+      }
+    }
+        
     rebuild_bitplanes();
       
     if (_needs_rebuild) {