Skip to content

Commit ce831a8

Browse files
authored
Merge pull request #5910 from davepagurek/fix/tess-warning
Fix texture coordinate warning when using beginShape(TESS)
2 parents 8fd2643 + 42e2591 commit ce831a8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/webgl/p5.RendererGL.Immediate.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ p5.RendererGL.prototype.vertex = function(x, y) {
116116
u /= this._tex.width;
117117
v /= this._tex.height;
118118
}
119-
} else if (this._tex === null && arguments.length >= 4) {
119+
} else if (
120+
!this.isProcessingVertices &&
121+
this._tex === null &&
122+
arguments.length >= 4
123+
) {
120124
// Only throw this warning if custom uv's have been provided
121125
console.warn(
122126
'You must first call texture() before using' +
@@ -179,7 +183,9 @@ p5.RendererGL.prototype.endShape = function(
179183
);
180184
return this;
181185
}
186+
this.isProcessingVertices = true;
182187
this._processVertices(...arguments);
188+
this.isProcessingVertices = false;
183189
if (this._doFill) {
184190
if (this.immediateMode.geometry.vertices.length > 1) {
185191
this._drawImmediateFill();

src/webgl/p5.RendererGL.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ p5.RendererGL = function(elt, pInst, isMainCanvas, attr) {
214214
// current curveDetail in the Quadratic lookUpTable
215215
this._lutQuadraticDetail = 0;
216216

217+
// Used to distinguish between user calls to vertex() and internal calls
218+
this.isProcessingVertices = false;
217219
this._tessy = this._initTessy();
218220

219221
this.fontInfos = {};

0 commit comments

Comments
 (0)