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

Framebuffer objects cannot be rendered after noTint() #7677

Open
2 of 17 tasks
BRNMan opened this issue Mar 28, 2025 · 4 comments
Open
2 of 17 tasks

Framebuffer objects cannot be rendered after noTint() #7677

BRNMan opened this issue Mar 28, 2025 · 4 comments

Comments

@BRNMan
Copy link

BRNMan commented Mar 28, 2025

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.3

Web browser and version

Firefox 136.0.2

Operating system

Linux Ubuntu 24.04 LTS

Steps to reproduce this

Steps:

  1. Create a canvas
  2. Create a framebuffer.
  3. Apply the noTint() method.
  4. Render the framebuffer to the canvas

Console Error:

p5.min.js:2 Uncaught TypeError: Cannot read properties of null (reading 'slice')
    at i.value (p5.min.js:2:1025180)
    at s.value (p5.min.js:2:1006042)
    at l.default.RendererGL._drawImmediateFill (p5.min.js:2:900625)
    at l.default.RendererGL.endShape (p5.min.js:2:896735)
    at S.default.RendererGL.image (p5.min.js:2:769005)
    at C.default.image (p5.min.js:2:638168)
    at draw (drawing2.js:14:3)
    at e.default.redraw (p5.min.js:2:542412)
    at _draw (p5.min.js:2:467307)

Essentially I think the image command eventually calls setFillUniforms for framebuffers which expects a tint. If you remove the tint, we get an error.

Snippet:

let fb;

function setup() {
  createCanvas(600, 600, WEBGL);
  fb = createFramebuffer();
}

function draw() {
  noTint();
  fb.begin();
  line(0,0,500,500);
  fb.end();
  imageMode(CORNERS);
  image(fb,
    0,0,100,100); 
}
@BRNMan BRNMan added the Bug label Mar 28, 2025
Copy link

welcome bot commented Mar 28, 2025

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!

@NavyaNayer
Copy link

I am working on this

@davepagurek
Copy link
Contributor

Thanks @NavyaNayer! I'll assign this to you. Also as a heads up, we're going to be releasing p5 2.0 in the near future, and development for that is on the dev-2.0 branch currently. We definitely still want to fix bugs in 1.x on main, but once you've found out what's going on, it would also be great to also check if the problem also exists on 2.0, and if so, if your fix applies there too 🙂

@NavyaNayer
Copy link

NavyaNayer commented Apr 2, 2025

Hello @davepagurek,

Update: I have submitted a PR that fixes this issue: #7695.

Summary of Fix:
Fixed framebuffer rendering issue after noTint() by setting its default value to [255, 255, 255, 255] instead of null.

Improved uniform handling to prevent slicing errors.

Added better type checking for shader uniform values.

Let me know if there’s any feedback or if any additional changes are required! 😊

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

3 participants