OpenGL的2D矢量图形渲染器

OpenGL的2D矢量图形渲染器

本文介绍了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也不为所动,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:

  • https://www.youtube.com/watch?v=FVYl4o1rgIs
  • https://www.youtube.com/watch?v=yZBXGLlmg2U

您当然可以加载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