Browse Source

report frame buffer properties more accurately

David Rose 21 years ago
parent
commit
bf70f96471

+ 20 - 1
panda/src/mesadisplay/osMesaGraphicsPipe.cxx

@@ -96,7 +96,26 @@ make_gsg(const FrameBufferProperties &properties,
     DCAST_INTO_R(share_gsg, share_with, NULL);
   }
 
-  return new OSMesaGraphicsStateGuardian(properties, share_gsg);
+  // We ignore the requested properties; OSMesa contexts are all the
+  // same.
+
+  FrameBufferProperties mesa_props;
+
+  int frame_buffer_mode = 
+    FrameBufferProperties::FM_rgba | 
+    FrameBufferProperties::FM_single_buffer | 
+    FrameBufferProperties::FM_accum | 
+    FrameBufferProperties::FM_depth | 
+    FrameBufferProperties::FM_stencil | 
+    FrameBufferProperties::FM_software;
+
+  mesa_props.set_frame_buffer_mode(frame_buffer_mode);
+  mesa_props.set_color_bits(24);
+  mesa_props.set_alpha_bits(8);
+  mesa_props.set_stencil_bits(8);
+  mesa_props.set_depth_bits(8);
+
+  return new OSMesaGraphicsStateGuardian(mesa_props, share_gsg);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 0 - 9
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx

@@ -37,15 +37,6 @@ OSMesaGraphicsStateGuardian(const FrameBufferProperties &properties,
   }
 
   _context = OSMesaCreateContext(OSMESA_RGBA, share_context);
-
-  // I think OSMesa always creates single-buffered contexts.  I don't
-  // see any documentation to this effect, but it seems to be the
-  // case.
-  FrameBufferProperties props = get_properties();
-  int mode = props.get_frame_buffer_mode();
-  mode = (mode & ~FrameBufferProperties::FM_buffer) | FrameBufferProperties::FM_single_buffer;
-  props.set_frame_buffer_mode(mode);
-  set_properties(props);
 }
 
 ////////////////////////////////////////////////////////////////////