7

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.

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?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Nathan
  • 7,099
  • 14
  • 61
  • 125
  • Unless the author wants OpenGL + 2D vector graphics at the same time. – tibur Oct 29 '10 at 18:21
  • Let me try to clarify what I want. I want to load a vector graphic file (i.E. SVG), do my normal OpenGL calls mixed with a call to draw the vector graphic file. I admit, the other thread answers these partially. – Nathan Oct 29 '10 at 19:16
  • The question linked by Josh Lee is IMHO way too broad to a duplicate of this or even have an answer that would't be of booklet size... – Fizz Aug 06 '14 at 14:20
  • 1
    On the other hand http://stackoverflow.com/questions/4129932/rendering-vector-graphics-in-opengl surely is a duplicate. – Fizz Aug 06 '14 at 14:54

3 Answers3

2

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.

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:

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.)

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

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

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.

Fizz
  • 4,782
  • 1
  • 24
  • 51
1

Take a look at OpenVG.

tibur
  • 11,531
  • 2
  • 37
  • 39
  • Thanks. OpenVG seems cool. But I am a bit confused. It is only a standard, not an library, right? Does a (open source) hardwar accelerated implementation exist for Linux and windows? – Nathan Oct 29 '10 at 19:04
  • Well. I thought that there was an Nvidia implementation. Look at this thread: [Best OpenVG implementation?](http://stackoverflow.com/questions/401422/best-openvg-implementation). – tibur Oct 29 '10 at 20:22
1

Lots of discussion in this Slashdot post about renderers for SVG. I don't know which of them using OpenGL, if any.

This SO question also has several suggestions, including sauvage which is done in Python. Cairo is also apparently a possibility.

There are several powerful libraries that render SVG without OpenGL. I wonder if it's not really that necessary: maybe drawing lines is already accelerated enough on most systems' graphics cards.

Community
  • 1
  • 1
LarsH
  • 27,481
  • 8
  • 94
  • 152