Skip to content

[p5.js 2.0 Bug Report]: cirlce() and a few other primitives don't work in buildGeometry() #8184

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0.5 (2.0+)

Web browser and version

Any

Operating system

Any

Steps to reproduce this

Steps:

  1. Create geometry with a circle in it: buildGeometry(() => circle(0, 0, 100)
  2. Don't actually draw the returned geometry

It draws to the screen anyway and the returned geometry has 0 vertices.

This is because some 3D primitive drawing functions call _drawGeometry(), which is currently a function that the renderer calls after it's checked if a buildGeoemtry is in progress. So circle and other methods that directly call _drawGeometry need updating.

Snippet:

function setup() {
  createCanvas(400, 400, WEBGL);
  geom = buildGeometry(() => circle(0, 0, 100))
  console.log(geom.vertices.length)
}

Live: https://editor.p5js.org/davepagurek/sketches/Eil5dyQA6

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions