From f3cb236f9d0e559e759dabc7cb5b6c1368d45e6e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 20 Dec 2018 17:27:40 -0300 Subject: Remove usage of VAO, which does not work in GLES2 --- drivers/gles2/rasterizer_canvas_gles2.cpp | 9 +++++++-- drivers/gles2/rasterizer_storage_gles2.cpp | 9 --------- drivers/gles2/rasterizer_storage_gles2.h | 1 - 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/gles2') diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index f1bb8803f1..86fe45e498 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -1368,14 +1368,19 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons } } - glBindVertexArray(cc->array_id); + glBindBuffer(GL_ARRAY_BUFFER, cc->vertex_id); + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cc->index_id); + glDrawElements(GL_TRIANGLES, cc->len * 3, GL_UNSIGNED_SHORT, 0); instance = instance->next; } } - glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } void RasterizerCanvasGLES2::reset_canvas() { diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index a98d2518b2..810fa701c0 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -4247,7 +4247,6 @@ RID RasterizerStorageGLES2::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); } @@ -4342,12 +4341,6 @@ void RasterizerStorageGLES2::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); } } @@ -4570,8 +4563,6 @@ bool RasterizerStorageGLES2::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); diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 2f5745459a..7f9bcb4854 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -1179,7 +1179,6 @@ public: struct CanvasOccluder : public RID_Data { - GLuint array_id; // 0 means, unconfigured GLuint vertex_id; // 0 means, unconfigured GLuint index_id; // 0 means, unconfigured PoolVector lines; -- cgit v1.2.3