Skip to content

[p5.js 2.0 Bug Report]: [2.2 beta] Drawing text sometimes fails with webgl errors #8392

@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

No response

Web browser and version

No response

Operating system

No response

Steps to reproduce this

Steps:

  1. Draw some text to make sure text rendering is set up
  2. Draw something with a lot of faces, e.g. sphere()
  3. Draw more text

The second batch of text doesn't render, and has this warning:

WebGL warning: drawElementsInstanced: Indexed vertex fetch requires 27 vertices, but attribs only supply 4.

Snippet:

async function setup() {
  createCanvas(400, 400, WEBGL)
  const font = await loadFont('https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZhrib2Bg-4.ttf')
  
  background(255)
  noStroke()
  
  fill(0)
  textAlign(CENTER, CENTER)
  textFont(font)
  textSize(30)
  text('Test 1', 0, -20)
  
  fill(200, 200, 255)
  sphere(30)
  
  clearDepth()
  fill(0)
  text('Test 2', 0, 20)
}
Image

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions