You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the following code to draw a fill five-pointed star, and I don't know why the fill color is protruding
nvgBeginPath(vg);
struct Point {
float x;
float y;
};
Point _points[5] = {};
float r = 100;
for (int i = 0; i < 5; i++) {
float du = 72 * (i + 1) * M_PI / 180;
_points[i] = Point{ r * std::cos(du) + 200, r * std::sin(du) + 200 };
}
nvgMoveTo(vg, _points[0].x, _points[0].y);
nvgLineTo(vg, _points[2].x, _points[2].y);
nvgLineTo(vg, _points[4].x, _points[4].y);
nvgLineTo(vg, _points[1].x, _points[1].y);
nvgLineTo(vg, _points[3].x, _points[3].y);
nvgClosePath(vg);
//nvgPathWinding(vg, NVG_CW); //it is fill Normal after adding this
nvgFillColor(vg, nvgRGBA(169, 192, 50, 255));
nvgFill(vg);
nvgStrokeWidth(vg, 3);
nvgStrokeColor(vg, nvgRGBA(169, 86, 250, 255));
nvgStroke(vg);
When I added nvgPathWinding(vg, NVG_CW); After this, he is filling up normally and why?
I checked the docs and said that nanovg's fill mode is even-odd filling rule , so I don't understand Thank you for this library Very good to use Hope to get an answer.
The text was updated successfully, but these errors were encountered:
nanovg has some flaws when calculating whether a polygon is convex. The reason for this issue is that nanovg considers the star to be a convex polygon, so it uses the drawing method of convex polygons instead of stencil-then-cover, resulting in incorrect drawing results.
nanovg has some flaws when calculating whether a polygon is convex. The reason for this issue is that nanovg considers the star to be a convex polygon, so it uses the drawing method of convex polygons instead of stencil-then-cover, resulting in incorrect drawing results.
I used the following code to draw a fill five-pointed star, and I don't know why the fill color is protruding
When I added
nvgPathWinding(vg, NVG_CW);
After this, he is filling up normally and why?I checked the docs and said that nanovg's fill mode is even-odd filling rule , so I don't understand Thank you for this library Very good to use Hope to get an answer.
The text was updated successfully, but these errors were encountered: