diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index 75859f056b..7ae60d7b01 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -625,13 +625,12 @@ class Shader { 'The shader being run is attached to a different context. Do you need to copy it to this context first with .copyToContext()?' ); } else if (this._glProgram === 0) { - this._renderer = context._renderer.filterRenderer - ? context._renderer.filterRenderer._renderer - : context._renderer; + this._renderer = context?._renderer?.filterRenderer?._renderer || context?._renderer; this.init(); } } + /** * Queries the active attributes for this shader and loads * their names and locations into the attributes array.