project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
changeset 4939 6d512ba87f72
parent 4935 27fb500dd6b1
child 4976 088d40d8aba2
equal deleted inserted replaced
4938:0985edac2ad7 4939:6d512ba87f72
   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);