CodingTrain / CodingTrain/Suggestion-Box
P5.js texture() error - Uncaught TypeError: Cannot read property 'width' of undefined
- Dominant language
- No language data
- Stars
- 570
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I have come across with a problem while practising the following lesson.
https://www.youtube.com/watch?v=O1mYw-3Wl_Q
texture(); function doesn't work for me. I have attached the console log error as well.
https://imgur.com/a/pc41X
```javascript
let visual;
function preLoad(){
visual = loadImage('http://i55.tinypic.com/16axyx0.jpg');
}
function setup(){
createCanvas(windowWidth,windowHeight,WEBGL);
}
function draw(){
ambientLight(0,0,255);
background(51);
noStroke();
//normalMaterial();
//ambientMaterial(255);
rotateX(frameCount*0.01);
rotateY(frameCount*0.01);
rotateZ(frameCount*0.01);
//ellipsoid(width/6);
texture(visual);
box(200,200,200);
}
function windowResized(){
resizeCanvas(windowWidth,windowHeight,WEBGL);
}
```
Thanks in advance.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.