From 9567247c9aac3326ea64f75455248eb214f15f07 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Dec 2014 14:00:17 +0100 Subject: [PATCH] Allow using rgb32 and rgb16 for render to texture when alpha-bits is 0 --- panda/src/glstuff/glGraphicsBuffer_src.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index ae5e228e9a..a7649c68aa 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -673,13 +673,22 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, if (_fb_properties.get_float_color()) { tex->set_component_type(Texture::T_float); } - if (_fb_properties.get_color_bits() > 16 * 3) { - tex->set_format(Texture::F_rgba32); - tex->set_component_type(Texture::T_float); - } else if (_fb_properties.get_color_bits() > 8 * 3) { - tex->set_format(Texture::F_rgba16); + if (_fb_properties.get_alpha_bits() == 0) { + if (_fb_properties.get_color_bits() > 16 * 3) { + tex->set_format(Texture::F_rgb32); + } else if (_fb_properties.get_color_bits() > 8 * 3) { + tex->set_format(Texture::F_rgb16); + } else { + tex->set_format(Texture::F_rgb); + } } else { - tex->set_format(Texture::F_rgba); + if (_fb_properties.get_color_bits() > 16 * 3) { + tex->set_format(Texture::F_rgba32); + } else if (_fb_properties.get_color_bits() > 8 * 3) { + tex->set_format(Texture::F_rgba16); + } else { + tex->set_format(Texture::F_rgba); + } } } }