Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setFrame() under WEBGL environment not rendering correct frame #7370

Open
2 of 17 tasks
pacpapapa opened this issue Nov 9, 2024 · 2 comments
Open
2 of 17 tasks

setFrame() under WEBGL environment not rendering correct frame #7370

pacpapapa opened this issue Nov 9, 2024 · 2 comments

Comments

@pacpapapa
Copy link

pacpapapa commented Nov 9, 2024

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

1.11.1

Web browser and version

Arc 130.0.6723.117

Operating system

macOS 13.2.1

Steps to reproduce this

Steps:

  1. Here is an example: https://editor.p5js.org/a25811342/sketches/ctcrkd_71
  2. gif.getCurrentFrame() shows that it does apply assigned frame to the object.
  3. However, when using image() to render the image, the one in WEBGL environment is still, but the other one works fine with default renderer. (object be placed in another layer without WEBGL using createGraphics())

Snippet:

let gif;
let layer2d;

function preload() {
  gif = loadImage('Rotating_earth_(large).gif');
}

function setup() {
  createCanvas(400, 400, WEBGL);
  layer2d = createGraphics(width, height);
}

function draw() {
  background(220);
  
  let gifFrame = frameCount % (gif.numFrames());
  gif.setFrame(gifFrame);
  print(gif.getCurrentFrame());
  
  // setFrame() cannot apply to WEBGL environment.
  image(gif, -200, -200, 200, 200);
  
  // but work fine with default renderer.
  layer2d.image(gif, 0, 0, 200, 200);
  image(layer2d, 0, 0);
}
@pacpapapa pacpapapa added the Bug label Nov 9, 2024
Copy link

welcome bot commented Nov 9, 2024

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

@rishabhs-rizz
Copy link

good issue, could you please assign this issue to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants