summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-01-02 18:07:49 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-01-02 18:07:49 -0300
commit7a5a4d135e127416c2a2fadcedc9bf5e7a13b37d (patch)
tree94c6a6fe5ad5810ce266cbf46923a1d9dae3f4f6 /drivers
parent58a67a1e0f412b3daf7f4905ad7d0ebb1dc0cf6b (diff)
parent0b7a5b84255a53138b3a092175de7b6b9f32b058 (diff)
Merge pull request #998 from sanikoyes/Pr-fix-gles2-canvas_draw_polygon
Fix RasterizerGLES2::canvas_draw_polygon can't work correct at some devi...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 9d47084c1c..0072ca9c86 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -8189,7 +8189,14 @@ void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indic
if (p_indices) {
- glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
+ static const int _max_draw_poly_indices = 8*1024; // change this size if needed!!!
+ ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices);
+ static uint16_t _draw_poly_indices[_max_draw_poly_indices];
+ for (int i=0; i<p_vertex_count; i++) {
+ _draw_poly_indices[i] = p_indices[i];
+ };
+ glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, _draw_poly_indices );
+ //glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
} else {
glDrawArrays(GL_TRIANGLES,0,p_vertex_count);
}