From 840f28ef182b703d08dcb028dd3809b20846ffae Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 19 Dec 2018 12:43:39 +0100 Subject: [PATCH] glgsg: fix framebuffer_copy_to_ram format for float framebuffers --- .../src/glstuff/glGraphicsStateGuardian_src.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 7974a9345c..df2095284c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -7049,6 +7049,16 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z, } else { format = Texture::F_srgb; } + } else if (_current_properties->get_float_color()) { + if (_current_properties->get_alpha_bits()) { + format = Texture::F_rgba32; + } else if (_current_properties->get_blue_bits()) { + format = Texture::F_rgb32; + } else if (_current_properties->get_green_bits()) { + format = Texture::F_rg32; + } else { + format = Texture::F_r32; + } } else { if (_current_properties->get_alpha_bits()) { format = Texture::F_rgba; @@ -7058,7 +7068,11 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z, } if (_current_properties->get_float_color()) { component_type = Texture::T_float; - } else if (_current_properties->get_color_bits() <= 24) { + } else if (_current_properties->get_color_bits() <= 24 + && _current_properties->get_red_bits() <= 8 + && _current_properties->get_green_bits() <= 8 + && _current_properties->get_blue_bits() <= 8 + && _current_properties->get_alpha_bits() <= 8) { component_type = Texture::T_unsigned_byte; } else { component_type = Texture::T_unsigned_short;