Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


OpenGL and SVG rendering in C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Martin Perry   Members   -  Reputation: 1343

Like
0Likes
Like

Posted 15 June 2014 - 12:34 PM

Hi ai am looking for some way how to render SVG graphics.

 

I have come up with two possible solutions:

 

1) Convert it to set of triangles and fill them with colors

 

2) Render to texture SVG and then only display it

 

For either one of them, I am not able to find any solution written in C++ and being multiplaform (Windows, Linux, Mac, iOS, Android).  Do you know something that can be used ?

Or I can write something on my own, but I am not very familiar with SVG, so I dont know how complex it is (I have written collada loader once and it was pain in the ass.. so wacko.png )



Sponsor:

#2 Promit   Moderators   -  Reputation: 7658

Like
0Likes
Like

Posted 15 June 2014 - 01:19 PM

One way to do this is to build it on top of OpenVG. This SO thread has some suggestions of OpenVG implementations.



#3 Martin Perry   Members   -  Reputation: 1343

Like
0Likes
Like

Posted 15 June 2014 - 02:02 PM

I have looked at OpenVG and its not directly supported on mobile devices, as I see it. Last stable version is 1.1 and little old (2008). Extensions build on top of it are either for mobile or desktop, nothing really multiplatform. And most of the projects is also pretty outdated. Wonder why, since SVG is the only vector format widely used and supported by HTML5 unsure.png



#4 Promit   Moderators   -  Reputation: 7658

Like
0Likes
Like

Posted 15 June 2014 - 02:03 PM

Try this one: https://github.com/micahpearlman/MonkVG

Built on top of OpenGL ES 2.0, supports most iOS/Android.


Edited by Promit, 15 June 2014 - 02:04 PM.


#5 Martin Perry   Members   -  Reputation: 1343

Like
0Likes
Like

Posted 15 June 2014 - 02:26 PM

I have looked at that, but it violates my requirement for desktop support (eg. full OpenGL). I am afraid, that realtime library with ES and full OpenGL support together doesnt exist.

 

I would just be happy for something that only convert SVG to raster texture. I can generate it during install or resolution change and than only use it as background. But even for this I have not found suitable solution.



#6 Promit   Moderators   -  Reputation: 7658

Like
1Likes
Like

Posted 15 June 2014 - 04:05 PM

Last time I had to port something from ES to desktop OpenGL, I think it took half an hour. Maybe less. I don't think you should consider that a deal breaker. But if you just need something to offline render it, I think Cairo might be able to do it?


Edited by Promit, 15 June 2014 - 04:06 PM.


#7 Martin Perry   Members   -  Reputation: 1343

Like
0Likes
Like

Posted 16 June 2014 - 04:27 AM

For now, thanks.. I will give it a try :)



#8 Mfabbri77   Members   -  Reputation: 114

Like
0Likes
Like

Posted 19 July 2014 - 12:31 AM

I would just be happy for something that only convert SVG to raster texture. I can generate it during install or resolution change and than only use it as background. But even for this I have not found suitable solution.

 

At Mazatech we have developed AmanithSVG, a middleware aimed to the static SVG rendering: http://www.mazatech.com/amanithsvg/

 

We are releasing our SDK as Unity3d plug-in and as Standalone library.

 

The software is written in pure ANSI C++ and it's crossplatform:

  • Android (ARM, ARMv7, MIPS, X86)
  • iOS7 (Universal Binary)
  • MacOS X (Universal Binary)
  • Windows (X86, X86_64)
  • Linux (ARM, ARMv7, MIPS, PPC, X86, X86_64).

If a closed source solution could fit you requirements, feel free to send me a PM.

 

Watch the video tutorial (Unity3d plugin version) at: https://vimeo.com/100983415

 

ScreenShot00.png

 

ScreenShot01.png



#9 wack   Members   -  Reputation: 1348

Like
0Likes
Like

Posted 19 July 2014 - 02:48 PM

Last time I had to port something from ES to desktop OpenGL, I think it took half an hour. Maybe less. I don't think you should consider that a deal breaker. But if you just need something to offline render it, I think Cairo might be able to do it?


I have myself been keeping an eye open for good open source SVG rendering libraries, but have found none that works really well. (Any tips anyone might have are welcome).

Cairo has the primitives needed to render SVG, but I think it has no way of doing SVG filters like blur and so on. If you don't need that, it can probably be made to work. It won't be trivial, though. Cairo has no built in support for rendering an SVG. Inkscape (SVG editing program) has been struggling for years with attempting to convert their renderer to use Cairo instead. They still are not done.

There exists a library built on top of Cairo called librsvg. I don't know how well it supports advanced features like filters, though. The problem with librsvg is that it isn't very standalone, it requires a lot of the base libraries for the GTK+ toolkit.

QT also has an SVG renderer. I tried it, and it doesn't support filters. It also isn't very standalone as it requires much of QT functionality.

The problem with making a decent SVG renderer seems to be text support. Most of the dependencies in librsvg and QTs implementation seem to be because of this.

My plan from the beginning was to have SVG as textures in a game, but after some research I just gave up and surrendered to use pixel graphics instead.

#10 OlegMax   Members   -  Reputation: 102

Like
0Likes
Like

Posted 29 July 2014 - 07:33 AM


I have myself been keeping an eye open for good open source SVG rendering libraries, but have found none that works really well. (Any tips anyone might have are welcome).

 

Hi. I'm now finishing development of first public version of SVG++ library that is intended to take most SVG headache from the developer. There is still documentation and samples to be done, but anyone interested may look onto it here






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS