* 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)
| 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 |
nothing calls this directly
no test coverage detected