在OpenGL中显示SVG,无中间光栅 [英] Displaying SVG in OpenGL without intermediate raster
问题描述
我有一些简单的SVG图片(图标和字形类型的东西),我想显示在OpenGL应用程序(使用C ++在Debian上开发,使用Qt)。
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).
显而易见的解决方案是使用ImageMagick库来将 SVG到光栅图像和纹理映射到一些合适的多边形(或只是使用好的老glDrawPixels)。
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).
但是,我想知道是否有任何东西其中将SVG直接转换为一系列OpenGL调用并使用OpenGL的线,多边形等来渲染它。
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 ?
推荐答案
Qt可以做到这一点。
QSvgRenderer 可以获取一个SVG并将其绘制在 QGLWidget
如果你想在QGLWidget上绘制其他东西,你可能需要用 paintEvent()
SVG。
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.
这篇关于在OpenGL中显示SVG,无中间光栅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!