GPencil Drawing: Enable polygon smoothing
authorJoshua Leung <aligorith@gmail.com>
Mon, 1 Dec 2014 23:51:55 +0000 (12:51 +1300)
committerJoshua Leung <aligorith@gmail.com>
Mon, 1 Dec 2014 23:51:55 +0000 (12:51 +1300)
This helps to reduce jaggies from thin lines, while also resulting in nicer
lines elsewhere.

I'm not sure if it's just me, but it seems to render slightly differently to
before for 3d strokes too (i.e. they seem a bit softer). Hopefully the
difference isn't big enough to affect/degrade the art style of any projects.

source/blender/editors/gpencil/drawgpencil.c

index 2584f5782504306dccf7ef2a459918bbfefb5f9a..245f22cad1c3d6387855a66183d9ed9f709021c5 100644 (file)
@@ -957,6 +957,9 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
        /* turn on smooth lines (i.e. anti-aliasing) */
        glEnable(GL_LINE_SMOOTH);
        
        /* turn on smooth lines (i.e. anti-aliasing) */
        glEnable(GL_LINE_SMOOTH);
        
+       glEnable(GL_POLYGON_SMOOTH);
+       glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+       
        /* turn on alpha-blending */
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glEnable(GL_BLEND);
        /* turn on alpha-blending */
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glEnable(GL_BLEND);
@@ -1055,6 +1058,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
        /* turn off alpha blending, then smooth lines */
        glDisable(GL_BLEND); // alpha blending
        glDisable(GL_LINE_SMOOTH); // smooth lines
        /* turn off alpha blending, then smooth lines */
        glDisable(GL_BLEND); // alpha blending
        glDisable(GL_LINE_SMOOTH); // smooth lines
+       glDisable(GL_POLYGON_SMOOTH); // smooth poly lines
                
        /* restore initial gl conditions */
        glLineWidth(1.0);
                
        /* restore initial gl conditions */
        glLineWidth(1.0);