Skip to content

textOutput() and gridOuput() are incomplete and inaccurate in WEBGL #6126

Open
@calebfoss

Description

@calebfoss

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
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.6.0

Web browser and version

No response

Operating System

No response

Steps to reproduce this

I first identified this issue in the discussion for PR #6122

When using WEBGL mode, textOutput() and gridOutput() only produce descriptions of 2D shapes, and the descriptions are inaccurate because they do not take into account the difference in origin point or the camera settings.

In the example below, the textOutput describes a square in the upper left corner (rather than lower right where it appears on the canvas) and does not include the sphere.

function setup() {
  createCanvas(400, 400, WEBGL);
  textOutput();
}

function draw() {
  background(220);
  sphere();
  square(100, 100, 100);
}

Live in p5 editor

I think producing accurate descriptions in WEBGL would be a big undertaking, and in the meantime, I think it would be best for textOuput() and gridOutput() to throw a friendly error when called in WEBGL mode. I'm happy to open a PR for this.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Open for Discussion

Relationships

None yet

Development

No branches or pull requests

Issue actions