diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-15 00:48:38 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-15 00:49:03 +0300 |
commit | dfd383ca00f412118318c92ae249bb5db4c36425 (patch) | |
tree | 967e31c833f68b032f0cd66296c243ffb4b4f59c /source/blender/blenkernel/intern/subsurf_ccg.c | |
parent | 9cc1953210486a240f77b7ceafbcd664d1994b57 (diff) |
Fix overdrawing and errors with textured and mapped drawing
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 733cb15ea86..7cb6f35b8c1 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2622,7 +2622,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, unsigned int next_actualFace; unsigned int gridFaces = ccgSubSurf_getGridSize(ss) - 1; int mat_index; - int tot_element, start_element; + int tot_element, start_element, tot_drawn; CCG_key_top_level(&key, ss); ccgdm_pbvh_update(ccgdm); @@ -2657,7 +2657,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, totpoly = bufmat->totpolys; tot_element = 0; - start_element = bufmat->start; + tot_drawn = 0; + start_element = 0; for (i = 0; i < totpoly; i++) { int polyindex = bufmat->polys[i]; @@ -2703,23 +2704,26 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, flush |= compareDrawOptions(userData, actualFace, next_actualFace) == 0; } + tot_element += facequads * 6; + if (flush) { if (draw_option != DM_DRAW_OPTION_SKIP) - tot_element += facequads * 6; + tot_drawn += facequads * 6; - if (tot_element) { + if (tot_drawn) { if (mcol && draw_option != DM_DRAW_OPTION_NO_MCOL) GPU_color_switch(1); else GPU_color_switch(0); - GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, start_element, tot_element); + GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, bufmat->start + start_element, tot_drawn); + tot_drawn = 0; } start_element = tot_element; } else { - tot_element += facequads * 6; + tot_drawn += facequads * 6; } } } |