]> git.mxchange.org Git - simgear.git/commitdiff
ShivaVG: Support for pseudo non-zero fillrule
authorThomas Geymayer <tomgey@gmail.com>
Fri, 21 Sep 2012 20:03:44 +0000 (22:03 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Wed, 24 Oct 2012 23:02:23 +0000 (01:02 +0200)
simgear/canvas/ShivaVG/src/shPipeline.c

index 1e07bc56a32ca4d628ac968ad280741aa09fe107..005c9c690207ae7990e566c9b28a868f42d147f0 100644 (file)
@@ -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);