equal
deleted
inserted
replaced
235 NSInteger size = width * height * 4; |
235 NSInteger size = width * height * 4; |
236 GLubyte *buffer = (GLubyte *) malloc(size * sizeof(GLubyte)); |
236 GLubyte *buffer = (GLubyte *) malloc(size * sizeof(GLubyte)); |
237 GLubyte *buffer_flipped = (GLubyte *) malloc(size * sizeof(GLubyte)); |
237 GLubyte *buffer_flipped = (GLubyte *) malloc(size * sizeof(GLubyte)); |
238 |
238 |
239 glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); |
239 glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); |
240 |
240 HW_screenshot(); |
241 // flip the data as glReadPixels here reads upside down |
241 // flip the data as glReadPixels here reads upside down |
242 for(int y = 0; y <height; y++) |
242 for(int y = 0; y <height; y++) |
243 for(int x = 0; x <width * 4; x++) |
243 for(int x = 0; x <width * 4; x++) |
244 buffer_flipped[(int)((height - 1 - y) * width * 4 + x)] = buffer[(int)(y * 4 * width + x)]; |
244 buffer_flipped[(int)((height - 1 - y) * width * 4 + x)] = buffer[(int)(y * 4 * width + x)]; |
245 free(buffer); |
245 free(buffer); |