Browse Source

gpu: fix compilation on platforms that don't have GL_BGRA.

undefined
Sam Hocevar 10 years ago
parent
commit
5fcc47b74c
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/gpu/framebuffer.cpp

+ 9
- 1
src/gpu/framebuffer.cpp View File

@@ -173,7 +173,11 @@ uint32_t FramebufferFormat::GetFormat()
case RGBA_32: case RGBA_32:
case RGBA_32_I: case RGBA_32_I:
case RGBA_32_UI: case RGBA_32_UI:
# if defined GL_BGRA
case RGBA_32_F: return (m_invert_rgb)?(GL_BGRA):(GL_RGBA); case RGBA_32_F: return (m_invert_rgb)?(GL_BGRA):(GL_RGBA);
# else
case RGBA_32_F: return GL_RGBA;
# endif
#else #else
case R_8: return GL_R8; case R_8: return GL_R8;
case R_8_I: return GL_R8I; 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_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_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: 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); return (m_invert_rgb)?(GL_BGRA):(GL_RGBA);
# else
return GL_RGBA;
# endif
#endif #endif
default: default:
ASSERT(false, "unknown framebuffer format order %d", m_format); ASSERT(false, "unknown framebuffer format order %d", m_format);
@@ -457,7 +465,7 @@ Image Framebuffer::GetImage() const
#else #else
u8vec4 *buffer = ret.Lock<PixelFormat::RGBA_8>(); u8vec4 *buffer = ret.Lock<PixelFormat::RGBA_8>();
glReadPixels(0, 0, m_data->m_size.x, m_data->m_size.y, 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); ret.Unlock(buffer);
#endif #endif




Loading…
Cancel
Save