Skip to content

Commit e7261a1

Browse files
committed
Texture() no longer throws an error if p5.dom isn't included
1 parent 72f6ac5 commit e7261a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/webgl/material.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ p5.prototype.texture = function(){
118118
textureData = args[0].canvas;
119119
}
120120
//if param is a video
121-
else if (args[0] instanceof p5.MediaElement){
121+
else if (typeof p5.MediaElement !== 'undefined' &&
122+
args[0] instanceof p5.MediaElement){
122123
if(!args[0].loadedmetadata) {return;}
123124
textureData = args[0].elt;
124125
}
@@ -133,7 +134,8 @@ p5.prototype.texture = function(){
133134
}
134135
else {
135136
if(args[0] instanceof p5.Graphics ||
136-
args[0] instanceof p5.MediaElement){
137+
(typeof p5.MediaElement !== 'undefined' &&
138+
args[0] instanceof p5.MediaElement)){
137139
textureData = args[0].elt;
138140
}
139141
else if(args[0] instanceof p5.Image){

0 commit comments

Comments
 (0)