From c386fca176f61289a4aa5b0f870008af0fc6ae7a Mon Sep 17 00:00:00 2001 From: Stephen Hill Date: Sun, 10 Jan 2016 22:55:33 -0500 Subject: [PATCH] Fixed swapped R and B in DX11 and OpenGL video capture Added missing swizzle for RGBA to BGRA (copied from saveScreenShot). --- src/renderer_d3d11.cpp | 7 +++++++ src/renderer_gl.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index cde4b3d0d..02a05126e 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -3081,6 +3081,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_MAPPED_SUBRESOURCE mapped; DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) ); + imageSwizzleBgra8(getBufferWidth() + , getBufferHeight() + , mapped.RowPitch + , mapped.pData + , mapped.pData + ); + g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch); m_deviceCtx->Unmap(m_captureTexture, 0); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 0da107745..231513251 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2899,6 +2899,11 @@ namespace bgfx { namespace gl , m_capture ) ); + if (GL_RGBA == m_readPixelsFmt) + { + imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture); + } + g_callback->captureFrame(m_capture, m_captureSize); } }