MCPcopy
hub / github.com/processing/p5.js / bindTextures

Method bindTextures

src/webgl/p5.Shader.js:825–849  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

823 * @private
824 */
825 bindTextures() {
826 const empty = this._renderer._getEmptyTexture();
827
828 for (const uniform of this.samplers) {
829 if (uniform.noData) continue;
830 let tex = uniform.texture;
831 if (
832 tex === undefined ||
833 (
834 // Make sure we unbind a framebuffer uniform if it's the same
835 // framebuffer that is actvely being drawn to in order to
836 // prevent a feedback cycle
837 tex.isFramebufferTexture &&
838 !tex.src.framebuffer.antialias &&
839 tex.src.framebuffer === this._renderer.activeFramebuffer()
840 )
841 ) {
842 // user hasn't yet supplied a texture for this slot.
843 // (or there may not be one--maybe just lighting),
844 // so we supply a default texture instead.
845 uniform.texture = tex = empty;
846 }
847 this._renderer._updateTexture(uniform, tex);
848 }
849 }
850
851 /**
852 * @private

Callers 4

_renderPassMethod · 0.80
_drawFillsMethod · 0.80
_drawStrokesMethod · 0.80
textFunction · 0.80

Calls 3

_getEmptyTextureMethod · 0.80
activeFramebufferMethod · 0.80
_updateTextureMethod · 0.45

Tested by

no test coverage detected