From c7a4859e3ca4028a6ab08eeccc9db07ad8dd8f3c Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 8 Jun 2006 17:25:06 +0000 Subject: [PATCH] read color_bits, etc. from config file --- panda/src/display/config_display.cxx | 6 +++++- panda/src/display/config_display.h | 1 + panda/src/display/frameBufferProperties.cxx | 19 ++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 3bec79eabb..54e7a12343 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -258,8 +258,12 @@ ConfigVariableBool framebuffer_depth "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 " + PRC_DESC("True if FM_alpha should be added to the default framebuffer " "properties, which requests an alpha channel if possible.")); +ConfigVariableBool framebuffer_stencil +("framebuffer-stencil", false, + PRC_DESC("True if FM_stencil should be added to the default framebuffer " + "properties, which requests an stencil buffer if possible.")); ConfigVariableBool framebuffer_stereo ("framebuffer-stereo", false, PRC_DESC("True if FM_stereo should be added to the default framebuffer " diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index da521b0a3b..ee78961ce1 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -78,6 +78,7 @@ 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_stencil; extern EXPCL_PANDA ConfigVariableBool framebuffer_stereo; extern EXPCL_PANDA ConfigVariableInt depth_bits; extern EXPCL_PANDA ConfigVariableInt color_bits; diff --git a/panda/src/display/frameBufferProperties.cxx b/panda/src/display/frameBufferProperties.cxx index 1e0cf25d08..da2c66b9dd 100644 --- a/panda/src/display/frameBufferProperties.cxx +++ b/panda/src/display/frameBufferProperties.cxx @@ -84,6 +84,7 @@ get_default() { 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) { @@ -108,21 +109,22 @@ get_default() { } 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] = 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_alpha_bits] = 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] = 1; + default_props._property[FBP_depth_bits] = depth_bits; } else if (cmp_nocase_uh(word, "stencil") == 0) { - default_props._property[FBP_stencil_bits] = 1; + default_props._property[FBP_stencil_bits] = stencil_bits; } else if (cmp_nocase_uh(word, "multisample") == 0) { - default_props._property[FBP_multisamples] = 1; + default_props._property[FBP_multisamples] = multisamples; } else if (cmp_nocase_uh(word, "stereo") == 0) { default_props._property[FBP_stereo] = 1; @@ -149,10 +151,13 @@ get_default() { default_props.set_multisamples(1); } if (framebuffer_depth) { - default_props.set_depth_bits(1); + default_props.set_depth_bits(depth_bits); } if (framebuffer_alpha) { - default_props.set_alpha_bits(1); + default_props.set_alpha_bits(alpha_bits); + } + if (framebuffer_stencil) { + default_props.set_stencil_bits(stencil_bits); } if (framebuffer_stereo) { default_props.set_stereo(1);