MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _captureBackBuffer

Method _captureBackBuffer

Engine/source/gfx/gl/screenshotGL.cpp:29–46  ·  view source on GitHub ↗

Note if MSAA is ever enabled this will need fixing

Source from the content-addressed store, hash-verified

27
28//Note if MSAA is ever enabled this will need fixing
29GBitmap* 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

Callers

nothing calls this directly

Calls 3

getAddressMethod · 0.80
dMemcpyFunction · 0.50
U32Enum · 0.50

Tested by

no test coverage detected