PearsonArtPhoto
PearsonArtPhoto

Reputation: 39698

Convert an Adobe Illustrator vector image to Open GL

How can I take a vector produced by Adobe Illustrator and get the points required to reproduce the image in Open GL calls?

What I'm wanting to do is to take some of my 2 dimensional artwork, and directly produce it on my programs. This will allow me to support any resolution I might require, while still looking crisp, and probably save some memory as well. I just can't figure out how to make it happen. Ultimately, this will go towards Android programming.

Upvotes: 1

Views: 1785

Answers (2)

corysimmons
corysimmons

Reputation: 7675

Use Inkscape's command line to --export-plain-svg on the Illustrator file. It's not a perfect conversion (particularly fonts) but it gets the job done.

Anyone know if Cairo has something similar to --export-plain-svg since Inkscape is based off of it and it's so low-level (faster)?

Upvotes: 0

datenwolf
datenwolf

Reputation: 162164

OpenGL is not a very good API to draw 2D vector graphics illustrations. Those usually contain a lot of curved patches (Bezier and/or NURBS), which must be broken down into triangles first, before they can be drawn using OpenGL.

There's another API, called OpenVG has been specially crafted to support drawing 2D vector illustrations. There's OpenGL interaction supported by some OpenVG implementations. And some OpenVG implementations do use OpenGL as their backend.

Another option and the more viable at this time, is using a vector graphics drawing library, that uses OpenGL as backend. One of those libraries is Cairo, which also provides a reader for SVG files.

Adobe Illustrator (.ai) is a propriatary format, so I'd rather not use it. However Illustrator can export to SVG just fine, and Cairo does read and draw SVG filed generated by Illustrator just fine.

Upvotes: 3

Related Questions