Closed DeDiamondPro closed 2 years ago
Hi, I'm trying to use nanosvg in LWJGL3 to render a basic svg but something seems to be going wrong somewhere.
Expected result: Result; Code:
NSVGImage image = ImageLoader.INSTANCE.getSVG(filename); NSVGShape shape = image.shapes(); NSVGPath path = shape.paths(); while (shape.address() != 0) { while (path.address() != 0) { nvgBeginPath(vg); nvgFillColor(vg, color(vg, new Color(255, 255, 255).getRGB())); nvgStrokeColor(vg, color(vg, new Color(255, 255, 255).getRGB())); nvgStrokeWidth(vg, shape.strokeWidth()); FloatBuffer points = path.pts(); nvgMoveTo(vg, points.get(), points.get()); while (points.remaining() >= 6) { nvgBezierTo(vg, points.get(), points.get(), points.get(), points.get(), points.get(), points.get()); } if (path.closed() == 1) { nvgMoveTo(vg, points.get(0), points.get(1)); } nvgStroke(vg); nvgClosePath(vg); path = path.next(); } shape = shape.next(); } path.free(); shape.free();
Things I tried:
Thanks in advance for your time.
I ended up switching too rasterizing.
Hi, I'm trying to use nanosvg in LWJGL3 to render a basic svg but something seems to be going wrong somewhere.
Expected result: Result; Code:
Things I tried:
Thanks in advance for your time.