summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_gles2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index bc1b17eade..057de329df 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -4174,7 +4174,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
DVector<uint8_t>::Write w = pixels.write();
glPixelStorei(GL_PACK_ALIGNMENT, 4);
- uint64_t time = OS::get_singleton()->get_ticks_usec();
+// uint64_t time = OS::get_singleton()->get_ticks_usec();
if (current_rt) {
#ifdef GLEW_ENABLED
@@ -4185,13 +4185,26 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
// back?
glReadPixels( viewport.x, window_size.height-(viewport.height+viewport.y), viewport.width,viewport.height,GL_RGBA,GL_UNSIGNED_BYTE,w.ptr());
}
- printf("readpixels time %i\n", (int)(OS::get_singleton()->get_ticks_usec() - time));
+
+ uint32_t *imgptr = (uint32_t*)w.ptr();
+ for(int y=0;y<(viewport.height/2);y++) {
+
+ uint32_t *ptr1 = &imgptr[y*viewport.width];
+ uint32_t *ptr2 = &imgptr[(viewport.height-y-1)*viewport.width];
+
+ for(int x=0;x<viewport.width;x++) {
+
+ uint32_t tmp = ptr1[x];
+ ptr1[x]=ptr2[x];
+ ptr2[x]=tmp;
+ }
+ }
+
w=DVector<uint8_t>::Write();
r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA,pixels);
- r_capture->flip_y();
+ //r_capture->flip_y();
- printf("total time %i\n", (int)(OS::get_singleton()->get_ticks_usec() - time));
#endif