summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_storage_gles3.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-06-13 01:23:04 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-06-13 01:23:04 -0300
commita8a1f2e2a864e6b58d5bcf1c7e53a43cdb6d95d9 (patch)
tree39a7c01d77ca73931ad48f14c28eb643d78864bb /drivers/gles3/rasterizer_storage_gles3.cpp
parent95c248e24fb6094160f9c71140402305b57469ab (diff)
-Fixed occluder rendering, closes #8560
-Ability to smooth out 2D shadow filters
Diffstat (limited to 'drivers/gles3/rasterizer_storage_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 858c543785..cf540c1577 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -6110,6 +6110,7 @@ RID RasterizerStorageGLES3::canvas_light_occluder_create() {
co->index_id = 0;
co->vertex_id = 0;
co->len = 0;
+ glGenVertexArrays(1, &co->array_id);
return canvas_occluder_owner.make_rid(co);
}
@@ -6181,7 +6182,7 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder,
if (!co->vertex_id) {
glGenBuffers(1, &co->vertex_id);
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
- glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_DYNAMIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
@@ -6194,7 +6195,7 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder,
glGenBuffers(1, &co->index_id);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, lc * 3 * sizeof(uint16_t), iw.ptr(), GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, lc * 3 * sizeof(uint16_t), iw.ptr(), GL_DYNAMIC_DRAW);
} else {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
@@ -6204,6 +6205,12 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder,
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //unbind
co->len = lc;
+ glBindVertexArray(co->array_id);
+ glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
+ glBindVertexArray(0);
}
}
@@ -6432,6 +6439,8 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
if (co->vertex_id)
glDeleteBuffers(1, &co->vertex_id);
+ glDeleteVertexArrays(1, &co->array_id);
+
canvas_occluder_owner.free(p_rid);
memdelete(co);