summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2018-12-20 17:27:40 -0300
committerJuan Linietsky <juan@godotengine.org>2018-12-20 17:28:01 -0300
commitf3cb236f9d0e559e759dabc7cb5b6c1368d45e6e (patch)
treec317f4a3df18fb3d0f0c969b2a8ccd3c4ca8406c
parent25b98e4842b910c07cfa95a797ac9bf43e7bfd94 (diff)
Remove usage of VAO, which does not work in GLES2
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp9
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp9
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
3 files changed, 7 insertions, 12 deletions
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<Vector2> lines;