TINYGL: Fixed a bug with triangle strip rendering.
This commit is contained in:
parent
1990876f7a
commit
5cd3cfe548
1 changed files with 12 additions and 3 deletions
|
@ -352,9 +352,18 @@ void RasterizationDrawCall::execute(bool restoreState) const {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TGL_TRIANGLE_STRIP:
|
case TGL_TRIANGLE_STRIP:
|
||||||
for(int i = 0; i < cnt; i += 2) {
|
while (cnt >= 3) {
|
||||||
gl_draw_triangle(c, &c->vertex[i], &c->vertex[i + 1], &c->vertex[i + 2]);
|
// needed to respect triangle orientation
|
||||||
gl_draw_triangle(c, &c->vertex[i + 2], &c->vertex[i + 1], &c->vertex[i + 3]);
|
switch (cnt & 1) {
|
||||||
|
case 0:
|
||||||
|
gl_draw_triangle(c, &c->vertex[2], &c->vertex[1], &c->vertex[0]);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cnt--;
|
||||||
|
c->vertex++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TGL_TRIANGLE_FAN:
|
case TGL_TRIANGLE_FAN:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue