diff --git a/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp b/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp index d33da3f01..80bdbfad3 100644 --- a/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp +++ b/src/Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp @@ -252,11 +252,6 @@ void DisplayWindowMupen64plus::_readScreen2(void * _dest, int * _width, int * _h if (_dest == nullptr) return; - u8 *pBufferData = (u8*)malloc((*_width)*(*_height) * 4); - if (pBufferData == nullptr) - return; - u8 *pDest = (u8*)_dest; - #if !defined(OS_ANDROID) && !defined(OS_IOS) GLint oldMode; glGetIntegerv(GL_READ_BUFFER, &oldMode); @@ -264,11 +259,14 @@ void DisplayWindowMupen64plus::_readScreen2(void * _dest, int * _width, int * _h glReadBuffer(GL_FRONT); else glReadBuffer(GL_BACK); - glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGBA, GL_UNSIGNED_BYTE, pBufferData); + glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGB, GL_UNSIGNED_BYTE, _dest); glReadBuffer(oldMode); #else + u8 *pBufferData = (u8*)malloc((*_width)*(*_height) * 4); + if (pBufferData == nullptr) + return; + u8 *pDest = (u8*)_dest; glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGBA, GL_UNSIGNED_BYTE, pBufferData); -#endif //Convert RGBA to RGB for (s32 y = 0; y < *_height; ++y) { @@ -283,6 +281,7 @@ void DisplayWindowMupen64plus::_readScreen2(void * _dest, int * _width, int * _h } free(pBufferData); +#endif } graphics::ObjectHandle DisplayWindowMupen64plus::_getDefaultFramebuffer()