Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[p5.js 2.0+ Bug Report]: TRIANGLES Requires Multiples of 3

オープン 初心者向け
#9,319 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript
領域
frontend

調査の方向性

まず、リンクされている p5.js エディタのスケッチで報告されたケースを再現します。beginShape(TRIANGLES) を呼び出し、4つの頂点を追加してから endShape() を呼び出します。追加の頂点が無視されていた p5.js 1 での結果と比較します。p5.js 2 が追加の頂点を実行時エラーなしで処理し、完全な三角形を描画できれば完了です。

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

説明

Area:Core p5.js 2.0+
Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

2.3.4

Web browser and version

No response

Operating system

No response

Steps to reproduce this
Steps:

Creating a custom shape using the beginShape(TRIANGLES) option in v2.0+ requires the number of vertices to be exactly a multiple of 3 or it will hit a runtime error and not draw anything. The error is not a particularly friendly one: TypeError: can't access property "position", v1 is undefined

In p5 V1, extra vertices that could not be wrangled into a triangle (e.g. a shape with 4 vertices) were simply ignored.

I think the V1 method makes a lot more sense, and we should go back to ignoring extra vertices. This would also maintain some continuity for people porting V1 code to V2.

Snippet:

https://editor.p5js.org/lewi0622/sketches/lnZLG0GhN


  beginShape(TRIANGLES);
  vertex(random(width), random(height));
  vertex(random(width), random(height));
  vertex(random(width), random(height));
  //uncommment fourth vertex to see issue in v2+, not in an issue in v1
  // vertex(random(width), random(height));
  endShape();

主要言語
JavaScript
スター
24.2k
フォーク
3.9k
平均マージ
2日 17時間
マージ済み PR(30日)
36

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

processing/p5.js のほかの issue

processing/p5.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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