Loading and Rendering SVG's

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
myrddian
Posts: 2
Joined: Sat Oct 16, 2010 2:42 am

Loading and Rendering SVG's

Post by myrddian »

Hi

I just started using irrlicht, and so far I like the engine, I am aware that IRRLICHT at the moment does not support loading and rendering of SVG's

The game I am working on needs to use SVG's because we are going for an 80's 2D vector graphics feel. I have found a parser called NanoSVG and plan to use that to load the data.

The question is however is there a way I can parse the vertex data from SVG into a format IRRLICHT can understand and render? Do i have to go right over the engine and use OpenGL Vertex2D calls directly?


Regards
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Post by agamemnus »

:?

You can save the data as polygons or triangles and load it back, then load the triangles into a mesh with Irrlicht...
myrddian
Posts: 2
Joined: Sat Oct 16, 2010 2:42 am

Post by myrddian »

So there is no way I can just pass an array of vertecies and triangle info to irrlicht?
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Of course there is :)
You can use this function[1] in the IVideoDriver-interface. There are other functions in that interface as well, you might want to browse through them to see what's available :)
Usually one packs triangles in meshbuffers and pass those to the driver with drawMeshBuffer, but i've no idea how to do that with 2d-polygons.

Note that before you pass the triangles to the video driver, you want to set the material[2] and the world transform[3].

[1] http://irrlicht.sourceforge.net/docu/cl ... 42af54d140
[2] http://irrlicht.sourceforge.net/docu/cl ... e538ebab05
[3] http://irrlicht.sourceforge.net/docu/cl ... 4f46e092fc
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, this library sounds interesting. However, I guess that it's rather limited. Still, if it's enbough for you it should be fairly simple to use. Just create an array of S3DVertex elements where you set X and Y to the values you get for the SVG points. You can set the vertex color to something you get from the library, in case it supports color. Then create an array of numbers from 0 to number of points you got from the library. Finally call draw3DVertexPrimitiveList where you pass the pointers you get from each array, some magic numbers around (should be self explaining) and either EPT_LINES or EPT_LINE_LOOP depending on the value you get from the library (just as in the example shown on their website). Please show some code if this does not work as expected.
Post Reply