CodingTrain / CodingTrain/Suggestion-Box

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

オープン
#862 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
570
フォーク
85
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、提供された JavaScript スケッチを p5.js の WEBGL モードで実行し、texture(visual) 周辺のコンソールを確認します。texture() と画像の読み込みに関するドキュメントを読み、その後、報告された TypeError なしでスケッチがテクスチャ付きのボックスをレンダリングすることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
computer-graphics
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。