summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/convex_decomp/b2d_decompose.h2
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp1
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp6
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp1
-rw-r--r--drivers/gles2/shaders/scene.glsl2
-rw-r--r--drivers/gles3/shaders/scene.glsl2
6 files changed, 11 insertions, 3 deletions
diff --git a/drivers/convex_decomp/b2d_decompose.h b/drivers/convex_decomp/b2d_decompose.h
index 068689d73d..b21792047e 100644
--- a/drivers/convex_decomp/b2d_decompose.h
+++ b/drivers/convex_decomp/b2d_decompose.h
@@ -31,8 +31,8 @@
#ifndef B2D_DECOMPOSE_H
#define B2D_DECOMPOSE_H
-#include "math_2d.h"
#include "vector.h"
+#include "vector2.h"
Vector<Vector<Vector2> > b2d_decompose(const Vector<Vector2> &p_polygon);
#endif // B2D_DECOMPOSE_H
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 3d388c031a..d6fbf04353 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -75,6 +75,7 @@ void RasterizerCanvasGLES2::canvas_begin() {
}
if (storage->frame.clear_request) {
+ glColorMask(true, true, true, true);
glClearColor(storage->frame.clear_request_color.r,
storage->frame.clear_request_color.g,
storage->frame.clear_request_color.b,
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index a1a0b9e2c6..73d93f7b46 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -392,6 +392,12 @@ void RasterizerGLES2::end_frame(bool p_swap_buffers) {
OS::get_singleton()->swap_buffers();
else
glFinish();
+
+ if (p_swap_buffers) {
+ glColorMask(true, true, true, true);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
}
void RasterizerGLES2::finalize() {
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 1bd3c0a935..6ff6bd7ced 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -3641,6 +3641,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
texture_set_flags(rt->texture, texture->flags);
+ glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// copy texscreen buffers
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 9251e21080..3e64c92e96 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -526,7 +526,7 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_NORMALMAP)
normalmap.xy = normalmap.xy * 2.0 - 1.0;
- normalmap.z = sqrt(1.0 - dot(normalmap.xy, normalmap.xy));
+ normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy)));
// normal = normalize(mix(normal_interp, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth)) * side;
normal = normalmap;
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index dee8bcbc58..2d6f42679f 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1700,7 +1700,7 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_NORMALMAP)
normalmap.xy=normalmap.xy*2.0-1.0;
- normalmap.z=sqrt(1.0-dot(normalmap.xy,normalmap.xy)); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
+ normalmap.z=sqrt(max(0.0, 1.0-dot(normalmap.xy,normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side;