From: John Tsiombikas Date: Sat, 3 Feb 2018 22:44:45 +0000 (+0200) Subject: clipping bugs... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=1723e332319e7732473814dfc168a13d0bafccb4 clipping bugs... --- diff --git a/src/3dgfx.c b/src/3dgfx.c index 46cc9ab..a90da7a 100644 --- a/src/3dgfx.c +++ b/src/3dgfx.c @@ -98,9 +98,7 @@ void g3d_framebuffer(int width, int height, void *pixels) pfill_fb.width = width; pfill_fb.height = height; - st->vport[0] = st->vport[1] = 0; - st->vport[2] = width; - st->vport[3] = height; + g3d_viewport(0, 0, width, height); } void g3d_viewport(int x, int y, int w, int h) @@ -404,6 +402,7 @@ void g3d_draw_indexed(int prim, const struct g3d_vertex *varr, int varr_size, nfaces = (iarr ? iarr_size : varr_size) / vnum; for(j=0; j pv[botidx].y) botidx = i; } - left = alloca(pfill_fb.height * sizeof *left); - right = alloca(pfill_fb.height * sizeof *right); + /* +1 to avoid crashing due to off-by-one rounding errors in the rasterization */ + left = alloca((pfill_fb.height + 1) * sizeof *left); + right = alloca((pfill_fb.height + 1) * sizeof *right); for(i=0; i