本文介绍了用于 OpenGL 的 2D 矢量图形渲染器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 OpenGL 游戏中使用矢量图形.我想使用矢量图形,因为它们可以在不损失质量的情况下进行廉价缩放.

I want to use Vector graphics in an OpenGL game. I want to use vector graphics because they can be scaled cheaply without loss of quality.

当然,绘图应该是硬件加速的,所以我不想在软件中绘制纹理.

Of course, the drawing should be hardware accelerated, so I do not want to draw in software to a texture.

现在我想知道是否已经存在这样做的图书馆.是否有一个库,可以加载一些矢量图形格式并使用 OpenGL 显示它?

Now I am wondering if a library doing this already exists. Is there a library, that can load some vector graphic format and display it using OpenGL?

推荐答案

我不会理会任何 OpenVG,甚至不会使用 MonkVG,这可能是最现代但不完整的实现.OpenVG 委员会已于 2011 年解散,大多数(如果不是全部)实现都是废弃软件,或者充其量是遗留软件.

I would not bother with anything OpenVG, not even with MonkVG, which is probably the most modern, albeit incomplete implementation. The OpenVG committee has folded in 2011 and most if not all implementations are abandonware or at best legacy software.

自 2011 年以来,最先进的是 Mark Kilgard 的宝贝 NV_path_rendering,它目前只是一个供应商 (Nvidia) 扩展,您可能已经从其名称中猜到了.有很多关于这方面的材料:

Since 2011, the state of the art is Mark Kilgard's baby, NV_path_rendering, which is currently only a vendor (Nvidia) extension as you might have guessed already from its name. There are a lot of materials on that:

  • https://developer.nvidia.com/nv-path-rendering Nvidia hub, but some material on the landing page is not the most up-to-date
  • http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/opengl/gpupathrender.pdf Siggraph 2012 paper
  • http://on-demand.gputechconf.com/gtc/2014/presentations/S4810-accelerating-vector-graphics-mobile-web.pdf GTC 2014 presentation
  • http://www.opengl.org/registry/specs/NV/path_rendering.txt official extension doc

NV_path_rendering 现在由 Google 的 Skia 库在幕后使用(如果可用).(Nvidia 在 2013 年底和 2014 年贡献了代码.)

NV_path_rendering is now used by Google's Skia library behind the scenes, when available. (Nvidia contributed the code in late 2013 and 2014.)

为了回答评论中提出的更具体的问题,您可以将路径渲染与其他 OpenGL (3D) 内容混合使用,如下所示:

And to answer a more specific point raised in the comments, you can mix path rendering with other OpenGL (3D) stuff, as demoed at:

您当然可以加载 SVG 等 https://www.youtube.com/watch?v=bCrohG6PJQE.它们还支持路径的 PostScript 语法.

You can of course load SVGs and such https://www.youtube.com/watch?v=bCrohG6PJQE. They also support the PostScript syntax for paths.

一个拥有更少(或完全没有)供应商支持或学术浮华的新贵是 NanoVG,它目前正在开发和维护.(https://github.com/memononen/nanovg) 鉴于 OpenGL 上具有的 2D 库的数量随着时间的推移来去匆匆,在我看来,您正在使用主要供应商不支持的东西进行大赌注.

An upstart having even less (or downright no) vendor support or academic glitz is NanoVG, which is currently developed and maintained. (https://github.com/memononen/nanovg) Given the number of 2D libraries over OpenGL that have come and gone over time, you're taking a big bet using something not supported by a major vendor, in my humble opinion.

这篇关于用于 OpenGL 的 2D 矢量图形渲染器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 02:12