MCPcopy Index your code
hub / github.com/processing/p5.js / update

Method update

src/webgl/p5.Texture.js:182–195  ·  view source on GitHub ↗

* Checks if the source data for this texture has changed (if it's * easy to do so) and reuploads the texture if necessary. If it's not * possible or to expensive to do a calculation to determine wheter or * not the data has occurred, this method simply re-uploads the texture.

()

Source from the content-addressed store, hash-verified

180 * not the data has occurred, this method simply re-uploads the texture.
181 */
182 update() {
183 const textureData = this._getTextureDataFromSource();
184 if (!textureData) return false;
185
186 let updated = false;
187
188 if (this._shouldUpdate(textureData)) {
189 this.bindTexture();
190 this._renderer.uploadTextureFromSource(this.textureHandle, textureData);
191 updated = true;
192 }
193
194 return updated;
195 }
196
197 _shouldUpdate(textureData) {
198 const data = this.src;

Callers 3

constructorMethod · 0.95
_shouldUpdateMethod · 0.45
_updateTextureMethod · 0.45

Calls 4

_shouldUpdateMethod · 0.95
bindTextureMethod · 0.95

Tested by

no test coverage detected