memononen / nanovg

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

Sanitize demo.c and perf.c not to introduce a dependency on OpenGL or GLFW headers needlessly. #555

Open marcel303 opened 4 years ago

marcel303 commented 4 years ago

Sanitize demo.c and perf.c so they can be used to make a demo app with any backend, without introducing a dependency to OpenGL or GLFW headers needlessly.

marcel303 commented 4 years ago

I wrote a NanoVG backend for 'framework' (a creative code library I'm working on). The backend is available over here, https://github.com/marcel303/framework/tree/master/3rdparty/nanovg-framework

I was running into the issue of not being able to compile an example app using demo.c and perf.c from NanoVG's repository. I put some OpenGL-only functionality behind a DEMO_OPENGL compile-time option. This makes demo.c and perf.c (and thus the example app) work with any backend, and without any OpenGL or GLTF dependency.