summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-01 18:58:50 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-01 18:58:50 -0300
commite15157f289dde2839c8e19b7020455bb8c4753a2 (patch)
tree28b4493652dc3d66f87aa913b33761ff4bd92167
parent1d7337ba10ad593f0786d3e356cf0b05aa9be2b4 (diff)
parent2ac767b1f52f2d5d9d6b2dc00e8c3d065b9fc9bb (diff)
Merge pull request #1414 from romulox-x/viewport_clear_alpha
changed viewport clearing to use the alpha value of the clear color, and...
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp2
-rw-r--r--servers/visual/visual_server_raster.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index fe42b67d23..b6a48652cb 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -4280,7 +4280,7 @@ void RasterizerGLES2::clear_viewport(const Color& p_color) {
}
glEnable(GL_SCISSOR_TEST);
- glClearColor(p_color.r,p_color.g,p_color.b,1.0);
+ glClearColor(p_color.r,p_color.g,p_color.b,p_color.a);
glClear(GL_COLOR_BUFFER_BIT); //should not clear if anything else cleared..
glDisable(GL_SCISSOR_TEST);
};
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 764a969e77..feb14d8a9d 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -6641,7 +6641,12 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
//clear the viewport black because of no camera? i seriously should..
if (p_viewport->render_target_clear_on_new_frame || p_viewport->render_target_clear) {
- rasterizer->clear_viewport(clear_color);
+ if (p_viewport->transparent_bg) {
+ rasterizer->clear_viewport(Color(0,0,0,0));
+ }
+ else {
+ rasterizer->clear_viewport(clear_color);
+ }
p_viewport->render_target_clear=false;
}
}