Follow these three simple steps to initialize the OpenGL SVG rendering capabilities of Sugar.
Include the header file <sugar/gl/GlSvgRenderer.h>, in addition to the files required by libsugar.
Instantiate a GlSvgRenderer object.
Call GlSvgRenderer::createGlSvgGeometry(*SugSvgDocument), where the parameter is the pointer to the SugSvgDocument that was previously parsed by libsugar.
Rendering is quite easy: simply call the GlSvgRenderer::render() function. If you need to draw the SVG in a different location, scale, or rotation on the screen, modify OpenGL's transformation matricies before the call to GlSvgRenderer::render(). The coordinates defined by the SVG document directly relate to OpenGL coordinates. For example, say you have a line defined by the two points (0,0) and (1,1) in the SVG document. During the rendering of this SVG document, a line from (0,0) to (1,1) will be drawn in OpenGL coordinates.
The main issue you have to deal with while rendering SVG documents is the difference between the SVG coordinate system and the OpenGL coordinate system. The SVG coordinate (0,0) is the upper left of the document. The OpenGL coordinate (0,0) is the lower left of the document. The renderer takes care of this conversion for you, but it does this by subtracting every coordinate's y value by the height attribute of the <svg> element. The specifics don't really matter. All you need to realize is that the dimensions of the SVG document must be correctly defined in order for the OpenGL renderer to draw it in the correct position.