@@ -147,15 +147,25 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
147147 {
148148 if ( data . points . length >= 6 )
149149 {
150- if ( data . points . length > 5 * 2 )
150+ if ( data . points . length < 6 * 2 )
151151 {
152- webGLData = PIXI . WebGLGraphics . switchMode ( webGL , 1 ) ;
153- PIXI . WebGLGraphics . buildComplexPoly ( data , webGLData ) ;
152+ webGLData = PIXI . WebGLGraphics . switchMode ( webGL , 0 ) ;
153+
154+ var canDrawUsingSimple = PIXI . WebGLGraphics . buildPoly ( data , webGLData ) ;
155+ // console.log(canDrawUsingSimple);
156+
157+ if ( ! canDrawUsingSimple )
158+ {
159+ // console.log("<>>>")
160+ webGLData = PIXI . WebGLGraphics . switchMode ( webGL , 1 ) ;
161+ PIXI . WebGLGraphics . buildComplexPoly ( data , webGLData ) ;
162+ }
163+
154164 }
155165 else
156166 {
157- webGLData = PIXI . WebGLGraphics . switchMode ( webGL , 0 ) ;
158- PIXI . WebGLGraphics . buildPoly ( data , webGLData ) ;
167+ webGLData = PIXI . WebGLGraphics . switchMode ( webGL , 1 ) ;
168+ PIXI . WebGLGraphics . buildComplexPoly ( data , webGLData ) ;
159169 }
160170 }
161171 }
@@ -803,6 +813,9 @@ PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
803813 var b = color [ 2 ] * alpha ;
804814
805815 var triangles = PIXI . PolyK . Triangulate ( points ) ;
816+
817+ if ( ! triangles ) return false ;
818+
806819 var vertPos = verts . length / 6 ;
807820
808821 var i = 0 ;
@@ -822,6 +835,7 @@ PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
822835 r , g , b , alpha ) ;
823836 }
824837
838+ return true ;
825839} ;
826840
827841PIXI . WebGLGraphics . graphicsDataPool = [ ] ;
0 commit comments