Displaying SVG in OpenGL without intermediate raster


Question

I have some simple SVG artwork (icon and glyph kind of things) which I want to display in an OpenGL app (developing in C++ on Debian, using Qt).

The obvious solution is to use the ImageMagick libs to convert the SVGs to raster images and texture map them onto some suitable polygons (or just use good old glDrawPixels).

However, I'm wondering if there's anything out there which will translate the SVG directly to a sequence of OpenGL calls and render it using OpenGL's lines, polygons and the like. Anyone know of anything which can do this ?

1
28
5/23/2017 10:29:49 AM

Accepted Answer

Qt can do this.
QSvgRenderer can take an SVG and paint it over a QGLWidget
Its possibly you'll need to fiddle around with the paintEvent() abit if you want to draw anything else on the QGLWidget other than the SVG.

12
9/1/2016 2:31:22 PM

SVGL appears to address this but has been dormant for several years. Still you might be able to find some code of value there.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon