Browse Source

Elimination of framebuffer-mode

Josh Yelon 18 years ago
parent
commit
1f290f2233
2 changed files with 54 additions and 86 deletions
  1. 13 18
      panda/src/display/config_display.cxx
  2. 41 68
      panda/src/display/frameBufferProperties.cxx

+ 13 - 18
panda/src/display/config_display.cxx

@@ -233,9 +233,9 @@ ConfigVariableString window_title
 ("window-title", "Panda");
 
 ConfigVariableString framebuffer_mode
-("framebuffer-mode", "rgb double-buffer",
- PRC_DESC("A space-separated list of keywords that describe the default "
-          "framebuffer properties requested for a window."));
+("framebuffer-mode", "",
+ PRC_DESC("No longer has any effect.  Do not use."));
+
 ConfigVariableBool framebuffer_hardware
 ("framebuffer-hardware", true,
  PRC_DESC("True if FM_hardware should be added to the default framebuffer "
@@ -269,25 +269,20 @@ ConfigVariableBool framebuffer_stereo
           "supported by the graphics driver."));
 
 ConfigVariableInt depth_bits
-("depth-bits", 1,
- PRC_DESC("The minimum number of depth bits requested if the depth keyword "
-          "is present in framebuffer-mode."));
+("depth-bits", 0,
+ PRC_DESC("The minimum number of depth buffer bits requested."));
 ConfigVariableInt color_bits
-("color-bits", 1,
- PRC_DESC("The minimum number of color bits requested in the default "
-          "framebuffer properties (sum of all three color channels)."));
+("color-bits", 0,
+ PRC_DESC("The minimum number of color buffer bits requested."));
 ConfigVariableInt alpha_bits
-("alpha-bits", 1,
- PRC_DESC("The minimum number of alpha bits requested if the alpha or rgba "
-          "keyword is present in framebuffer-mode."));
+("alpha-bits", 0,
+ PRC_DESC("The minimum number of alpha buffer bits requested."));
 ConfigVariableInt stencil_bits
-("stencil-bits", 1,
- PRC_DESC("The minimum number of stencil bits requested if the stencil keyword "
-          "is present in framebuffer-mode."));
+("stencil-bits", 0,
+ PRC_DESC("The minimum number of stencil buffer bits requested."));
 ConfigVariableInt multisamples
-("multisamples", 1,
- PRC_DESC("The minimum number of samples requested if the multisample keyword "
-          "is present in framebuffer-mode."));
+("multisamples", 0,
+ PRC_DESC("The minimum number of samples requested."));
 
 ConfigVariableDouble background_color
 ("background-color", "0.41 0.41 0.41",

+ 41 - 68
panda/src/display/frameBufferProperties.cxx

@@ -80,65 +80,23 @@ get_default() {
   default_props._property[FBP_rgb_color] = 1;
   
   int num_words = framebuffer_mode.get_num_words();
-  for (int i = 0; i < num_words; i++) {
-    string word = framebuffer_mode.get_word(i);
-    if (cmp_nocase_uh(word, "rgb") == 0) {
-      default_props._property[FBP_indexed_color] = 0;
-      default_props._property[FBP_color_bits] = color_bits;
-      default_props._property[FBP_rgb_color] = 1;
-
-    } else if (cmp_nocase_uh(word, "index") == 0) {
-      default_props._property[FBP_indexed_color] = 1;
-      default_props._property[FBP_rgb_color] = 0;
-
-    } else if (cmp_nocase_uh(word, "single") == 0 ||
-               cmp_nocase_uh(word, "single-buffer") == 0) {
-      default_props._property[FBP_back_buffers] = 0;
-
-    } else if (cmp_nocase_uh(word, "double") == 0 ||
-               cmp_nocase_uh(word, "double-buffer") == 0) {
-      default_props._property[FBP_back_buffers] = 1;
-
-    } else if (cmp_nocase_uh(word, "triple") == 0 ||
-               cmp_nocase_uh(word, "triple-buffer") == 0) {
-      default_props._property[FBP_back_buffers] = 2;
-
-    } else if (cmp_nocase_uh(word, "accum") == 0) {
-      default_props._property[FBP_accum_bits] = 1;
-
-    } else if (cmp_nocase_uh(word, "alpha") == 0) {
-      default_props._property[FBP_indexed_color] = 0;
-      default_props._property[FBP_rgb_color] = 1;
-      default_props._property[FBP_alpha_bits] = alpha_bits;
-      
-    } else if (cmp_nocase_uh(word, "rgba") == 0) {
-      default_props._property[FBP_indexed_color] = 0;
-      default_props._property[FBP_rgb_color] = 1;
-      default_props._property[FBP_color_bits] = color_bits;
-      default_props._property[FBP_alpha_bits] = alpha_bits;
-      
-    } else if (cmp_nocase_uh(word, "depth") == 0) {
-      default_props._property[FBP_depth_bits] = depth_bits;
-
-    } else if (cmp_nocase_uh(word, "stencil") == 0) {
-      default_props._property[FBP_stencil_bits] = stencil_bits;
-
-    } else if (cmp_nocase_uh(word, "multisample") == 0) {
-      default_props._property[FBP_multisamples] = multisamples;
-
-    } else if (cmp_nocase_uh(word, "stereo") == 0) {
-      default_props._property[FBP_stereo] = 1;
-
-    } else if (cmp_nocase_uh(word, "software") == 0) {
-      default_props._property[FBP_force_software] = 1;
-
-    } else if (cmp_nocase_uh(word, "hardware") == 0) {
-      default_props._property[FBP_force_hardware] = 1;
-
-    } else {
-      display_cat.warning()
-        << "Unknown framebuffer keyword: " << word << "\n";
-    }
+  if (num_words > 0) {
+    display_cat.error()
+      << "The config-variable 'framebuffer-mode' no longer functions.\n";
+    display_cat.error()
+      << "Instead, use one or more of these:\n";
+    display_cat.error() << "  framebuffer-hardware #t\n";
+    display_cat.error() << "  framebuffer-software #t\n";
+    display_cat.error() << "  framebuffer-depth #t\n";
+    display_cat.error() << "  framebuffer-alpha #t\n";
+    display_cat.error() << "  framebuffer-stencil #t\n";
+    display_cat.error() << "  framebuffer-multisample #t\n";
+    display_cat.error() << "  framebuffer-stereo #t\n";
+    display_cat.error() << "  depth-bits N\n";
+    display_cat.error() << "  color-bits N\n";
+    display_cat.error() << "  alpha-bits N\n";
+    display_cat.error() << "  stencil-bits N\n";
+    display_cat.error() << "  multisamples N\n";
   }
 
   if (framebuffer_hardware) {
@@ -147,21 +105,36 @@ get_default() {
   if (framebuffer_software) {
     default_props.set_force_software(1);
   }
-  if (framebuffer_multisample) {
-    default_props.set_multisamples(1);
-  }
   if (framebuffer_depth) {
-    default_props.set_depth_bits(depth_bits);
+    default_props.set_depth_bits(1);
   }
   if (framebuffer_alpha) {
-    default_props.set_alpha_bits(alpha_bits);
+    default_props.set_alpha_bits(1);
   }
   if (framebuffer_stencil) {
-    default_props.set_stencil_bits(stencil_bits);
+    default_props.set_stencil_bits(1);
+  }
+  if (framebuffer_multisample) {
+    default_props.set_multisamples(1);
   }
   if (framebuffer_stereo) {
     default_props.set_stereo(1);
   }
+  if (depth_bits > 0) {
+    default_props.set_depth_bits(depth_bits);
+  }
+  if (color_bits > 0) {
+    default_props.set_color_bits(color_bits);
+  }
+  if (alpha_bits > 0) {
+    default_props.set_alpha_bits(alpha_bits);
+  }
+  if (stencil_bits > 0) {
+    default_props.set_depth_bits(stencil_bits);
+  }
+  if (multisamples > 0) {
+    default_props.set_multisamples(multisamples);
+  }
   
   if ((default_props._property[FBP_force_software])&&
       (default_props._property[FBP_force_hardware])) {
@@ -558,7 +531,7 @@ verify_hardware_software(const FrameBufferProperties &props, const string &rende
     display_cat.error()
       << "if you actually *want* to use a software renderer, then\n";
     display_cat.error()
-      << "change the word 'hardware' to 'software' in the Config.prc file.\n";
+      << "alter the hardware/software configuration in your Config.prc file.\n";
     return false;
   }
 
@@ -568,9 +541,9 @@ verify_hardware_software(const FrameBufferProperties &props, const string &rende
     display_cat.error()
       << "driver, " << renderer << ", is probably hardware-accelerated.\n";
     display_cat.error()
-      << "If you want to allow hardware acceleration, then change the word\n";
+      << "If you want to allow hardware acceleration, then alter the\n";
     display_cat.error()
-      << "'software' to 'hardware' in the Config.prc file.\n";
+      << "hardware/software configuration in your Config.prc file.\n";
     return false;
   }