diff --git a/small3dlib.h b/small3dlib.h index b6d93ec..bc5eb73 100644 --- a/small3dlib.h +++ b/small3dlib.h @@ -1531,7 +1531,8 @@ void S3L_drawTriangle( loop */ #endif - if (rXClipped < lXClipped) + if (rXClipped < lXClipped && + lXClipped < S3L_RESOLUTION_X && rXClipped >= 0) { /* This can sometimes happen because of numerical errors in sorting left vs right triangle point, which are compared based on SLOPE, not diff --git a/testSDL.c b/testSDL.c index 0ef8922..31567f2 100644 --- a/testSDL.c +++ b/testSDL.c @@ -18,8 +18,8 @@ #define S3L_PIXEL_FUNCTION drawPixel -#define S3L_RESOLUTION_X 110 -#define S3L_RESOLUTION_Y 88 +#define S3L_RESOLUTION_X 640 +#define S3L_RESOLUTION_Y 480 #include "small3dlib.h"