Displaying SVG in OpenGL without intermediate raster(在没有中间光栅的情况下在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在没有中间光栅的情况下在 OpenGL 中显示 SVG
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
