在没有中间光栅的情况下在 OpenGL 中显示 SVG [英] Displaying SVG in OpenGL without intermediate raster

查看:43
本文介绍了在没有中间光栅的情况下在 OpenGL 中显示 SVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些简单的 SVG 图稿(图标和字形之类的东西),我想在 OpenGL 应用程序中显示它们(在 Debian 上用 C++ 开发,使用 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 上绘制除 SVG 以外的任何其他内容,则可能需要摆弄 paintEvent() 升位.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆