| 989 | } |
| 990 | |
| 991 | void SimpleOpenGL3App::getScreenPixels(unsigned char* rgbaBuffer, int bufferSizeInBytes, float* depthBuffer, int depthBufferSizeInBytes) |
| 992 | { |
| 993 | int width = m_data->m_customViewPortWidth >= 0 ? m_data->m_customViewPortWidth : (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenWidth(); |
| 994 | int height = m_data->m_customViewPortHeight >= 0 ? m_data->m_customViewPortHeight : (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenHeight(); |
| 995 | |
| 996 | b3Assert((width * height * 4) == bufferSizeInBytes); |
| 997 | if ((width * height * 4) == bufferSizeInBytes) |
| 998 | { |
| 999 | glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, rgbaBuffer); |
| 1000 | int glstat; |
| 1001 | glstat = glGetError(); |
| 1002 | b3Assert(glstat == GL_NO_ERROR); |
| 1003 | } |
| 1004 | b3Assert((width * height * sizeof(float)) == depthBufferSizeInBytes); |
| 1005 | if ((width * height * sizeof(float)) == depthBufferSizeInBytes) |
| 1006 | { |
| 1007 | glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer); |
| 1008 | int glstat; |
| 1009 | glstat = glGetError(); |
| 1010 | b3Assert(glstat == GL_NO_ERROR); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | //#define STB_IMAGE_WRITE_IMPLEMENTATION |
| 1015 | #include "stb_image/stb_image_write.h" |
no test coverage detected