mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
glgsg: Fix framebuffer_copy_to_ram for OpenGL ES using BGRA format
Supporting BGRA doesn't necessarily mean that it supports using BGRA in glReadPixels, for OpenGL ES. We need to check a separate extension.
This commit is contained in:
parent
6b19be495a
commit
f47b92347c
@ -1304,10 +1304,12 @@ reset() {
|
||||
// Note that these extensions only offer support for GL_BGRA, not GL_BGR.
|
||||
_supports_bgr = has_extension("GL_EXT_texture_format_BGRA8888") ||
|
||||
has_extension("GL_APPLE_texture_format_BGRA8888");
|
||||
_supports_bgra_read = has_extension("GL_EXT_read_format_bgra");
|
||||
#else
|
||||
// In regular OpenGL, we have both GL_BGRA and GL_BGR.
|
||||
_supports_bgr =
|
||||
is_at_least_gl_version(1, 2) || has_extension("GL_EXT_bgra");
|
||||
_supports_bgra_read = _supports_bgr;
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_FIXED_FUNCTION
|
||||
@ -7418,6 +7420,12 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z,
|
||||
|
||||
GLenum external_format = get_external_image_format(tex);
|
||||
|
||||
// OpenGL ES implementations may support BGRA, but that doesn't imply they
|
||||
// also support it for glReadPixels specifically.
|
||||
if (!_supports_bgra_read && external_format == GL_BGRA) {
|
||||
external_format = GL_RGBA;
|
||||
}
|
||||
|
||||
if (GLCAT.is_spam()) {
|
||||
GLCAT.spam()
|
||||
<< "glReadPixels(" << xo << ", " << yo << ", " << w << ", " << h << ", ";
|
||||
|
@ -815,6 +815,7 @@ public:
|
||||
PFNGLGETCOMPRESSEDTEXIMAGEPROC _glGetCompressedTexImage;
|
||||
|
||||
bool _supports_bgr;
|
||||
bool _supports_bgra_read;
|
||||
bool _supports_packed_dabc;
|
||||
bool _supports_packed_ufloat;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user