瀏覽代碼

add individual control over framebuffer-mode elements

David Rose 20 年之前
父節點
當前提交
84c88164ce

+ 29 - 1
panda/src/display/config_display.cxx

@@ -228,9 +228,37 @@ ConfigVariableString window_title
 ("window-title", "Panda");
 ("window-title", "Panda");
 
 
 ConfigVariableString framebuffer_mode
 ConfigVariableString framebuffer_mode
-("framebuffer-mode", "rgba double-buffer depth hardware",
+("framebuffer-mode", "rgb double-buffer",
  PRC_DESC("A space-separated list of keywords that describe the default "
  PRC_DESC("A space-separated list of keywords that describe the default "
           "framebuffer properties requested for a window."));
           "framebuffer properties requested for a window."));
+ConfigVariableBool framebuffer_hardware
+("framebuffer-hardware", true,
+ PRC_DESC("True if FM_hardware should be added to the default framebuffer "
+          "properties, which requests a hardware-accelerated display."));
+ConfigVariableBool framebuffer_software
+("framebuffer-software", false,
+ PRC_DESC("True if FM_software should be added to the default framebuffer "
+          "properties, which requests a software-only display."));
+ConfigVariableBool framebuffer_multisample
+("framebuffer-multisample", false,
+ PRC_DESC("True if FM_multisample should be added to the default framebuffer "
+          "properties, which requests a multisample-capable display, if "
+          "possible.  This can be used to implement full-screen "
+          "antialiasing."));
+ConfigVariableBool framebuffer_depth
+("framebuffer-depth", true,
+ PRC_DESC("True if FM_depth should be added to the default framebuffer "
+          "properties, which requests a depth buffer."));
+ConfigVariableBool framebuffer_alpha
+("framebuffer-alpha", true,
+ PRC_DESC("True if FM_depth should be added to the default framebuffer "
+          "properties, which requests an alpha channel if possible."));
+ConfigVariableBool framebuffer_stereo
+("framebuffer-stereo", false,
+ PRC_DESC("True if FM_stereo should be added to the default framebuffer "
+          "properties, which requests a stereo-capable display, if "
+          "supported by the graphics driver."));
+
 ConfigVariableInt depth_bits
 ConfigVariableInt depth_bits
 ("depth-bits", 1,
 ("depth-bits", 1,
  PRC_DESC("The minimum number of depth bits requested if the depth keyword "
  PRC_DESC("The minimum number of depth bits requested if the depth keyword "

+ 6 - 0
panda/src/display/config_display.h

@@ -75,6 +75,12 @@ extern EXPCL_PANDA ConfigVariableEnum<WindowProperties::ZOrder> z_order;
 extern EXPCL_PANDA ConfigVariableString window_title;
 extern EXPCL_PANDA ConfigVariableString window_title;
 
 
 extern EXPCL_PANDA ConfigVariableString framebuffer_mode;
 extern EXPCL_PANDA ConfigVariableString framebuffer_mode;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_hardware;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_software;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_multisample;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_depth;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_alpha;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_stereo;
 extern EXPCL_PANDA ConfigVariableInt depth_bits;
 extern EXPCL_PANDA ConfigVariableInt depth_bits;
 extern EXPCL_PANDA ConfigVariableInt color_bits;
 extern EXPCL_PANDA ConfigVariableInt color_bits;
 extern EXPCL_PANDA ConfigVariableInt alpha_bits;
 extern EXPCL_PANDA ConfigVariableInt alpha_bits;

+ 22 - 3
panda/src/display/frameBufferProperties.cxx

@@ -70,15 +70,15 @@ get_default() {
 
 
     } else if (cmp_nocase_uh(word, "single") == 0 ||
     } else if (cmp_nocase_uh(word, "single") == 0 ||
                cmp_nocase_uh(word, "single-buffer") == 0) {
                cmp_nocase_uh(word, "single-buffer") == 0) {
-      mode |= FM_single_buffer;
+      mode = (mode & ~FM_buffer) | FM_single_buffer;
 
 
     } else if (cmp_nocase_uh(word, "double") == 0 ||
     } else if (cmp_nocase_uh(word, "double") == 0 ||
                cmp_nocase_uh(word, "double-buffer") == 0) {
                cmp_nocase_uh(word, "double-buffer") == 0) {
-      mode |= FM_double_buffer;
+      mode = (mode & ~FM_buffer) | FM_double_buffer;
 
 
     } else if (cmp_nocase_uh(word, "triple") == 0 ||
     } else if (cmp_nocase_uh(word, "triple") == 0 ||
                cmp_nocase_uh(word, "triple-buffer") == 0) {
                cmp_nocase_uh(word, "triple-buffer") == 0) {
-      mode |= FM_triple_buffer;
+      mode = (mode & ~FM_buffer) | FM_triple_buffer;
 
 
     } else if (cmp_nocase_uh(word, "accum") == 0) {
     } else if (cmp_nocase_uh(word, "accum") == 0) {
       mode |= FM_accum;
       mode |= FM_accum;
@@ -113,6 +113,25 @@ get_default() {
     }
     }
   }
   }
 
 
+  if (framebuffer_hardware) {
+    mode |= FM_hardware;
+  }
+  if (framebuffer_software) {
+    mode |= FM_software;
+  }
+  if (framebuffer_multisample) {
+    mode |= FM_multisample;
+  }
+  if (framebuffer_depth) {
+    mode |= FM_depth;
+  }
+  if (framebuffer_alpha) {
+    mode |= FM_alpha;
+  }
+  if (framebuffer_stereo) {
+    mode |= FM_stereo;
+  }
+
   props.set_frame_buffer_mode(mode);
   props.set_frame_buffer_mode(mode);
   props.set_depth_bits(depth_bits);
   props.set_depth_bits(depth_bits);
   props.set_color_bits(color_bits);
   props.set_color_bits(color_bits);