summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-11-13 00:53:12 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-11-13 00:53:12 -0300
commitabbea4d945bbb1114570c3b6c7f649e01ca8ebb8 (patch)
treed2b131b32705bbcf118efa72d5d9a21618c1227e /drivers/gles2
parentd02953c5963ca080d26500ea8250e0632a80b234 (diff)
UDP Fixes
-=-=-=-=- Curse the day I decided to port UDP code, as it ended up being two nights of work. At least It's done now (I hope). -Fixed UDP Support, API seems stable -Added UDP Chat demo (chat that can lose your packets, heh) -Added helpers to areas and bodies to get list of collided bodies and contained bodies. -Sped up screen/viewport capture code. -Added code to save an image as PNG -Small fix so scripts register their singletons after modules did.
Diffstat (limited to 'drivers/gles2')
-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