From a25bd0613858cc0824276200525dc36c11187add Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 21 Sep 2012 22:03:44 +0200 Subject: [PATCH] ShivaVG: Support for pseudo non-zero fillrule --- simgear/canvas/ShivaVG/src/shPipeline.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/simgear/canvas/ShivaVG/src/shPipeline.c b/simgear/canvas/ShivaVG/src/shPipeline.c index 1e07bc56..005c9c69 100644 --- a/simgear/canvas/ShivaVG/src/shPipeline.c +++ b/simgear/canvas/ShivaVG/src/shPipeline.c @@ -332,8 +332,20 @@ VG_API_CALL void vgDrawPath(VGPath path, VGbitfield paintModes) /* Tesselate into stencil */ glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 0, 0); - glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT); + + if( context->fillRule == VG_EVEN_ODD ) + { + glStencilFunc(GL_ALWAYS, 0, 0); + glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT); + } + else + { + // pseudo non-zero fill rule. Fill everything at least covered once, don't + // care for possible decrements. + // TODO implement real non-zero fill-rule + glStencilFunc(GL_ALWAYS, 1, 1); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + } glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); shDrawVertices(p, GL_TRIANGLE_FAN); -- 2.39.5