diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-24 00:46:26 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-24 00:46:26 -0300 |
commit | 2fce78ad10d0c1457735a71544955dd7c991fcde (patch) | |
tree | a2aa443ed775eb865dba2a7e03cf5b574e65a4ce /drivers | |
parent | a74138a0dc5862d2c26eb78a141ba3c3f9d01c6d (diff) |
Correct viewport scaling with stretch mode viewport, fixes #1571
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index f0978228ff..e3a3e7def3 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -9260,7 +9260,13 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater glReadBuffer(GL_BACK); } #endif - glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); + if (current_rt) { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height); + canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height)); + //window_size.height-(viewport.height+viewport.y) + } else { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); + } // if (current_clip) { // // print_line(" a clip "); // } @@ -9457,7 +9463,12 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const glReadBuffer(GL_BACK); } #endif - glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h); + if (current_rt) { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height); + //window_size.height-(viewport.height+viewport.y) + } else { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); + } // if (current_clip) { // // print_line(" a clip "); // } |