memononen / nanosvg

Simple stupid SVG parser
zlib License
1.71k stars 363 forks source link

Use NanoVG to draw point arrays #76

Open raptor opened 7 years ago

raptor commented 7 years ago

Hi,

Can NanoVG be used to draw point arrays?

I'm currently attempting to port old code to NanoVG from OpenGL 1.x. There are several usages of rendering a vertex array of type GL_POINTS that I would like to convert but I do not see a way to do it with NanoVG.

Any help would be appreciated. Thanks!

memononen commented 7 years ago

There's no way to draw just points. You can draw circles or rectangles, but the performance will not be close to what you could get from GL_POINTS. Depending on your use case you could draw the points separately using opengl and other stuff with nanovg.

raptor commented 7 years ago

My motivation for using NanoVG was the GLES 2 support and I'm trying to avoid having to use more than one API (e.g. GL 1.x, 2.x, GLES 2.x, nanovg, etc.)

If I were to attempt to add in point-drawing functions into NanoVG, what would be a good way to go about it?

Edit: I just realized I opened an issue on the wrong project. I'm sorry for the mix-up, I meant 'nanovg' not 'nanosvg'.

memononen commented 7 years ago

In vector graphics there's no such thing as a point. You probably would draw a circle or rectangle instead. There's an API to do that already. I think adding point drawing at the API level does not fit the API. I do get your point about preferring to use just one API.

ps. no worries, I mix them all the time too :)