@@ -566,7 +566,7 @@ public class PGraphics extends PImage implements PConstants {
566566 protected int normalMode ;
567567
568568 /// Keep track of how many calls to normal, to determine the mode.
569- protected int normalCount ;
569+ // protected int normalCount;
570570
571571 /** Current normal vector. */
572572 public float normalX , normalY , normalZ ;
@@ -999,6 +999,7 @@ protected void vertexCheck() {
999999
10001000
10011001 public void vertex (float x , float y ) {
1002+ vertexCheck ();
10021003 float [] vertex = vertices [vertexCount ];
10031004
10041005 curveVertexCount = 0 ;
@@ -1033,6 +1034,7 @@ public void vertex(float x, float y) {
10331034
10341035
10351036 public void vertex (float x , float y , float z ) {
1037+ vertexCheck ();
10361038 float [] vertex = vertices [vertexCount ];
10371039
10381040 // only do this if we're using an irregular (POLYGON) shape that
@@ -1063,8 +1065,13 @@ public void vertex(float x, float y, float z) {
10631065
10641066 vertex [EDGE ] = edge ? 1 : 0 ;
10651067
1066- if (fill ) {
1067- if (textureImage != null ) {
1068+ if (fill || textureImage != null ) {
1069+ if (textureImage == null ) {
1070+ vertex [R ] = fillR ;
1071+ vertex [G ] = fillG ;
1072+ vertex [B ] = fillB ;
1073+ vertex [A ] = fillA ;
1074+ } else {
10681075 if (tint ) {
10691076 vertex [R ] = tintR ;
10701077 vertex [G ] = tintG ;
@@ -1076,11 +1083,6 @@ public void vertex(float x, float y, float z) {
10761083 vertex [B ] = 1 ;
10771084 vertex [A ] = 1 ;
10781085 }
1079- } else {
1080- vertex [R ] = fillR ;
1081- vertex [G ] = fillG ;
1082- vertex [B ] = fillB ;
1083- vertex [A ] = fillA ;
10841086 }
10851087
10861088 vertex [AR ] = ambientR ;
@@ -1903,7 +1905,8 @@ public void sphere(float r) {
19031905
19041906 pushMatrix ();
19051907 scale (r );
1906-
1908+ edge (false );
1909+
19071910 // 1st ring from south pole
19081911 beginShape (TRIANGLE_STRIP );
19091912 for (int i = 0 ; i < sphereDetailU ; i ++) {
@@ -1957,7 +1960,8 @@ public void sphere(float r) {
19571960 normal (0 , 1 , 0 );
19581961 vertex (0 , 1 , 0 );
19591962 endShape ();
1960-
1963+
1964+ edge (true );
19611965 popMatrix ();
19621966 }
19631967
0 commit comments