From 5fcc47b74c4aef75601c3dcdaede3e111a2fde41 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 2 Jul 2014 17:54:41 +0000 Subject: [PATCH] gpu: fix compilation on platforms that don't have GL_BGRA. --- src/gpu/framebuffer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gpu/framebuffer.cpp b/src/gpu/framebuffer.cpp index 69383a5a..251ac618 100644 --- a/src/gpu/framebuffer.cpp +++ b/src/gpu/framebuffer.cpp @@ -173,7 +173,11 @@ uint32_t FramebufferFormat::GetFormat() case RGBA_32: case RGBA_32_I: case RGBA_32_UI: +# if defined GL_BGRA case RGBA_32_F: return (m_invert_rgb)?(GL_BGRA):(GL_RGBA); +# else + case RGBA_32_F: return GL_RGBA; +# endif #else case R_8: return GL_R8; case R_8_I: return GL_R8I; @@ -290,7 +294,11 @@ uint32_t FramebufferFormat::GetFormatOrder() case RGBA_8: case RGBA_8_I: case RGBA_8_UI: case RGBA_8_F: case RGBA_16: case RGBA_16_I: case RGBA_16_UI: case RGBA_16_F: case RGBA_32: case RGBA_32_I: case RGBA_32_UI: case RGBA_32_F: +# if defined GL_BGRA return (m_invert_rgb)?(GL_BGRA):(GL_RGBA); +# else + return GL_RGBA; +# endif #endif default: ASSERT(false, "unknown framebuffer format order %d", m_format); @@ -457,7 +465,7 @@ Image Framebuffer::GetImage() const #else u8vec4 *buffer = ret.Lock(); glReadPixels(0, 0, m_data->m_size.x, m_data->m_size.y, - GL_BGRA, GL_UNSIGNED_BYTE, buffer); + GL_RGBA, GL_UNSIGNED_BYTE, buffer); ret.Unlock(buffer); #endif