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

Method copyToContext

src/webgl/p5.Shader.js:721–732  ·  view source on GitHub ↗

* Copies the shader from one drawing context to another. * * Each `p5.Shader` object must be compiled by calling * shader() before it can run. Compilation happens * in a drawing context which is usually the main canvas or an instance of * <a href="#/p5.Graphi

(context)

Source from the content-addressed store, hash-verified

719 * }
720 */
721 copyToContext(context) {
722 const args = [context._renderer];
723 if (this.shaderType === 'compute') {
724 args.push(this._computeSrc);
725 } else {
726 args.push(this._vertSrc, this._fragSrc);
727 }
728 args.push(this.hooks);
729 const shader = new Shader(...args);
730 shader.ensureCompiledOnContext(context._renderer);
731 return shader;
732 }
733
734 /**
735 * @private

Callers

nothing calls this directly

Calls 2

pushMethod · 0.45

Tested by

no test coverage detected