Hi Guanluca,

I've only used librsvg from the Ubunutu/debian repositories and haven't
come across problems before.  Perhaps there is a version issue, or perhaps
an issue with librsvg handling the .svg you are passing on.  As you are
working under Windows I think it may well be simply down to the libs and
the OSG being built with different options, this is a very common issue for
Windows programmers and comes with the territory am I afraid, it's another
one of the reasons that I haven't touched windows development for a
decade.

As for rendering svg using the scene graph/OpenGL rather than rendering to
a CPU based image then texturing this, we'll it's possible but a for more
complex issue than just relying upon a 3rd party lib to the handle all the
specifics of vector graphics.  NVidia do have a library that does vector
graphics ontop of OpenGL so this is probably the way one would tackle it.

Robert.

On 13 December 2012 12:11, Gianluca Natale <[email protected]> wrote:

>  Hi all,****
>
> I have a couple of issues/questions about the osg plugin for svg file
> format.****
>
> ** **
>
> 1.****
>
> I got win32 prebuilt versions of the library librsvg, and all required
> dependencies (glib, gdk-pixbuf, cairo, libcroco, fontconfig, libpng,
> freetype, gettext-runtime, libxml2, expat, pango), from this website:****
>
> http://ftp.acc.umu.se/pub/gnome/binaries/win32.****
>
> And rebuilt the osgdb_svg.dll plugin (in OSG 3.0.1).****
>
> When I try to read an svg image in my application, I have a crash in the
> yellow line in following function inside ReaderWriterSVG.cpp:****
>
> ** **
>
>         osg::Image* createImage(RsvgHandle *handle, unsigned int width,
> unsigned int height) const****
>
>         {****
>
>                 RsvgDimensionData dimensionData;****
>
>                 rsvg_handle_get_dimensions( handle, &dimensionData);****
>
>                 // If image resollution < 128, cairo produces some
> artifacts.****
>
>                 // I don't know why, but we check the size...****
>
>                 if (width < 128) width = 128;****
>
>                 if (height < 128) height = 128;****
>
>                 width = osg::Image::computeNearestPowerOfTwo(width);****
>
>                 height = osg::Image::computeNearestPowerOfTwo(height);****
>
>                 osg::Image *image = new osg::Image();****
>
>                 image->allocateImage(width, height, 1, GL_RGBA,
> GL_UNSIGNED_BYTE);****
>
>                 image->setPixelFormat(GL_BGRA);****
>
> ** **
>
>                 cairo_surface_t *cairo_surface =
> cairo_image_surface_create_for_data(image->data(),****
>
>                                         CAIRO_FORMAT_ARGB32, width,
> height, image->getRowSizeInBytes());****
>
>                 cairo_t *cr = cairo_create(cairo_surface);****
>
>                 cairo_scale(cr,((float)width)/dimensionData.width, ((float
> )height)/dimensionData.height);****
>
>                 rsvg_handle_render_cairo(handle, cr);****
>
>                         ****
>
>                 cairo_destroy(cr);****
>
>                 free(cairo_surface);****
>
> ** **
>
>                 image->flipVertical();****
>
>                 return image;****
>
>         }****
>
> ** **
>
> It looks like a memory corruption. Any idea about what might be wrong?****
>
> Could anyone of you build and use the svg plugin successfully? If yes,
> where did you get the librsvg library? What version? What versions for
> required dependencies?****
>
> ** **
>
> 2.****
>
> I looked into ReaderWriterSVG.cpp, and saw that the plugin can read an svg
> as an image. Since the svg is a vector file format, isn’t there a way in
> OSG to directly construct a scene graph from that file, returning for
> example the root node of that scene graph? Also, I saw that there is no
> ‘writeImage’ implementation. Is there any way to write an svg file,
> starting from a scene graph (i.e. passing the root node of such a graph)?
> Or can it only manage the svg files as raster images?****
>
> ** **
>
> Thanks****
>
> Gianluca****
>
> ** **
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to