memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.13k stars 768 forks source link

Any port to METAL api ? #257

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello,

Nanovg is a great library : clearly simple to use, and providing great rending with low footprint. I understood it is based on top of OpenGL, and two other ports exists (D3D11 and BGFX).

As METAL api seems to become the standard on Apple devices (Mac and iOS) - and Vulkan is not planned for the moment for these devices - I would have liked to know if someone already ported NanoVG to METAL ?

To be honest, I've rewritten my engine for METAL support, which provided 20% performance gain, and I would have liked to include NanoVG but writing port to METAL seems quite painful... So, if anybody started this work, I would be pleased to contribute to it.

Best regards,

Geequlim commented 8 years ago

BGFX can render with Metal on Apple devices. You should have a try. :)

ghost commented 8 years ago

Yes, BGFX has basic Metal support, but it is not optimized and it crashes in several samples.

I'm interested in a real Metal port of Nanovg, providing the best performances.

Another API was pretty simple to port, IMGUI, because it is very simple, but Nanovg seems a lot more powerful

olliwang commented 8 years ago

I was trying to port my nanovg app to bgfx/metal backend. The first issue I encountered is that bgfx does not respect the devicePixelRatio parameter passed to the nvgBeginFrame() function. I've fixed this and open a pull request. Please merge it so I can improve the integration. https://github.com/memononen/nanovg/pull/297

olliwang commented 7 years ago

I just implemented the native Metal port of NanoVG. Check this out. ;) https://github.com/ollix/MetalNanoVG