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.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index cb137294d8..a7edc8d935 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -36,6 +36,7 @@
#include "servers/visual/particle_system_sw.h"
#include "gl_context/context_gl.h"
#include <string.h>
+#include <stdlib.h>
#ifdef GLEW_ENABLED
#define _GL_HALF_FLOAT_OES 0x140B
@@ -5455,9 +5456,16 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
}
- light_data[VL_LIGHT_ATTENUATION][0]=l->vars[VS::LIGHT_PARAM_ENERGY];
- light_data[VL_LIGHT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_RADIUS];
- light_data[VL_LIGHT_ATTENUATION][2]=l->vars[VS::LIGHT_PARAM_ATTENUATION];
+ light_data[VL_LIGHT_ATTENUATION][0] = l->vars[VS::LIGHT_PARAM_ENERGY];
+
+ if (l->type == VS::LIGHT_DIRECTIONAL) {
+ light_data[VL_LIGHT_ATTENUATION][1] = l->directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE];
+ }
+ else{
+ light_data[VL_LIGHT_ATTENUATION][1] = l->vars[VS::LIGHT_PARAM_RADIUS];
+ }
+
+ light_data[VL_LIGHT_ATTENUATION][2] = l->vars[VS::LIGHT_PARAM_ATTENUATION];
light_data[VL_LIGHT_SPOT_ATTENUATION][0]=Math::cos(Math::deg2rad(l->vars[VS::LIGHT_PARAM_SPOT_ANGLE]));
light_data[VL_LIGHT_SPOT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_SPOT_ATTENUATION];
@@ -7018,6 +7026,10 @@ void RasterizerGLES2::_process_glow_bloom() {
void RasterizerGLES2::_process_hdr() {
+ if (framebuffer.luminance.empty()) {
+ return;
+ }
+
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, framebuffer.color );
@@ -10850,11 +10862,11 @@ void RasterizerGLES2::init() {
// Check for GL 2.1 compatibility, if not bail out
if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
+ "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
"Godot Engine will self-destruct as soon as you acknowledge this error message.",
"Fatal error: Insufficient OpenGL / GLES drivers");
- // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :)
+ exit(1);
}
#endif