Note if MSAA is ever enabled this will need fixing
| 27 | |
| 28 | //Note if MSAA is ever enabled this will need fixing |
| 29 | GBitmap* ScreenShotGL::_captureBackBuffer() |
| 30 | { |
| 31 | glPixelStorei(GL_PACK_ALIGNMENT, 1); |
| 32 | glReadBuffer(GL_BACK); |
| 33 | |
| 34 | Point2I size = GFX->getViewport().extent; |
| 35 | U8* pixels = new U8[size.x * size.y * 4]; |
| 36 | glReadPixels(0, 0, size.x, size.y, GL_RGB, GL_UNSIGNED_BYTE, pixels); |
| 37 | |
| 38 | GBitmap* bitmap = new GBitmap(size.x, size.y); |
| 39 | |
| 40 | for (U32 y = 0; y < (U32)size.y; y++) |
| 41 | dMemcpy(bitmap->getAddress(0, y), pixels + y * size.x * 3, U32(size.x * 3)); |
| 42 | |
| 43 | delete[] pixels; |
| 44 | |
| 45 | return bitmap; |
| 46 | } |
| 47 |
nothing calls this directly
no test coverage detected