diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index ff28f4c192..032c4ed2a3 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -964,8 +964,26 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, } else { gl_format = GL_R16F; } - } else if (_fb_properties.get_color_bits() > 8 * 3) { - gl_format = GL_RGB16_EXT; + } else if (_fb_properties.get_color_bits() > 10 * 3 || + _fb_properties.get_red_bits() > 10 || + _fb_properties.get_green_bits() > 10 || + _fb_properties.get_blue_bits() > 10) { + // 16-bit normalized. + if (_fb_properties.get_blue_bits() > 0 || + _fb_properties.get_color_bits() == 1 || + _fb_properties.get_color_bits() > 16 * 2) { + gl_format = GL_RGBA16; + } else if (_fb_properties.get_green_bits() > 0 || + _fb_properties.get_color_bits() > 16) { + gl_format = GL_RG16; + } else { + gl_format = GL_R16; + } + } else if (_fb_properties.get_color_bits() > 8 * 3 || + _fb_properties.get_red_bits() > 8 || + _fb_properties.get_green_bits() > 8 || + _fb_properties.get_blue_bits() > 8) { + gl_format = GL_RGB10_A2; } else { gl_format = GL_RGB; } @@ -982,7 +1000,7 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, if (_fb_properties.get_color_bits() > 16 * 3) { gl_format = GL_RGBA32F_ARB; } else if (_fb_properties.get_color_bits() > 8 * 3) { - gl_format = GL_RGBA16_EXT; + gl_format = GL_RGBA16; } else { gl_format = GL_RGBA; }