Skip to content

Image copy not updating Image (WEBGL) #8811

@HTsuyoshi

Description

@HTsuyoshi

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.11.13

Web browser and version

150.0.2

Operating system

Windows

Steps to reproduce this

Steps:

  1. Load Image 1
  2. Create Image 2 object
  3. Copy part of Image 1 into new Image 2 Object
  4. The image does not change
  5. The image changes only when I update one pixel in the new Image 2 Object
  6. Also tried updatePixels()

Snippet:

P5JS website example: https://editor.p5js.org/HTsuyoshi/full/Y8dWgkFhX

let img,
    imgCrop;

function setup() {
  createCanvas(400, 400, WEBGL);
  
  img = loadImage('./Screenshot.png');
  imgCrop = createImage(100, 100);
}

function draw() {
  imgCrop.copy(
      img,
      mouseX - (width * .5), mouseY - (height * .5), img.width, img.height,
      0, 0, imgCrop.width, imgCrop.height
  );
  //imgCrop.set(0, 0, color(0, 0, 0));
  
  background(220);
  image(imgCrop, 0, 0, imgCrop.width, imgCrop.height);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions