Clipping and coplanar polygons in SVG rendering

Started by
-1 comments, last by VideroBoy 13 years, 9 months ago
I am slowly but surely chipping away at my OpenGL SVG renderer. I'm now able to parse path data and am close to translating it into something that can be jammed into one or more VBOs. I'm at the point where I want to consider how I'm going to arrange the different shapes in an SVG image.

An SVG is a collage of shapes drawn on top of each other, so I'd be dealing with coplanar polygons. With the help of a good polygon clipping library I'll be able to merge shapes of the same colour and cut away shapes that will never be visible. I will still have coplanar polygons left though in order to handle transparent shapes and also because I need to keep the polygons that will be rendered as curves (I'm going to use Loop and Blinn's method of shader-based curves). The different ways a bezier curve polygon could get clipped in my scheme makes it seem too much of a hassle to implement.

So I'm not sure how to handle any remaining coplanar polygons in an SVG mesh. I'm leery about turning off depth testing, even though it would get the exact effect I'm looking for, because I want to be able to place an SVG mesh in a 3D environment. I also don't trust glPolygonOffset, especially if I have many layered polygons. For instance, I would have two coplanar triangles for every single curve segment. Something using the stencil may work, but it wouldn't be the same as decals since a top shape is not necessarily contained by a bottom shape.

This topic is closed to new replies.

Advertisement