diff options
| author | raysan5 <raysan5@gmail.com> | 2018-12-29 00:29:28 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2018-12-29 00:29:28 +0100 |
| commit | 95d3f24c686c09c458bedeb6486ffc75dfda4170 (patch) | |
| tree | 8b359162a891092722addc16023b822c59264d4c /src | |
| parent | a072385c6da533331661b25f6ed24fae0f8fd41f (diff) | |
| download | raylib-95d3f24c686c09c458bedeb6486ffc75dfda4170.tar.gz raylib-95d3f24c686c09c458bedeb6486ffc75dfda4170.zip | |
Use QUADS for DrawPolyEx()
Diffstat (limited to 'src')
| -rw-r--r-- | src/shapes.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shapes.c b/src/shapes.c index 3e0379a3..83cdbe98 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -503,18 +503,28 @@ void DrawPolyEx(Vector2 *points, int pointsCount, Color color) { if (pointsCount >= 3) { - if (rlCheckBufferLimit(pointsCount)) rlglDraw(); + if (rlCheckBufferLimit((pointsCount - 2)*4)) rlglDraw(); - rlBegin(RL_TRIANGLES); + rlEnableTexture(GetShapesTexture().id); + rlBegin(RL_QUADS); rlColor4ub(color.r, color.g, color.b, color.a); for (int i = 1; i < pointsCount - 1; i++) { + rlTexCoord2f(recTexShapes.x/texShapes.width, recTexShapes.y/texShapes.height); rlVertex2f(points[0].x, points[0].y); + + rlTexCoord2f(recTexShapes.x/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); rlVertex2f(points[i].x, points[i].y); + + rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); + rlVertex2f(points[i + 1].x, points[i + 1].y); + + rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, recTexShapes.y/texShapes.height); rlVertex2f(points[i + 1].x, points[i + 1].y); } rlEnd(); + rlDisableTexture(); } } |
