Skip to content

[p5.js 2.0 Bug Report]: Texture coordinates broken when using rect() with rounded corners #8196

@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. Load an image
  2. Use it as a texture with texture(img)
  3. Draw a rounded rectangle with rect(x, y, w, h, radius)

The rectangle should have the image on it, but instead, it stretches out a single column of pixels.

1.11.0:

Image

2.0.5:
Image

Snippet:

let img
async function setup() {
  createCanvas(400, 400, WEBGL);
  img = await loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg')
  
  texture(img)
  rect(-150, -100, 300, 200, 8)
}

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions