CodingTrain / CodingTrain/Suggestion-Box

P5.js texture() error - Uncaught TypeError: Cannot read property 'width' of undefined

Aperta
#862 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
570
Fork
85
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by running the supplied JavaScript sketch with p5.js in WEBGL mode and inspect the console around texture(visual). Read the texture() and image-loading documentation, then verify that the sketch renders the textured box without the reported TypeError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
computer-graphics
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.