p5.js
p5.js copied to clipboard
fixed no_tint issue while rendering
trafficstars
Fix: Framebuffer Rendering Issue After noTint() Call
Resolves #7677
Summary of Changes
This PR fixes a bug where calling noTint() before rendering a framebuffer would cause an error and prevent correct rendering. The fix ensures that noTint() correctly updates shader uniforms without breaking the framebuffer rendering pipeline.
Key Fixes:
- Fixed framebuffer rendering failure after
noTint()by setting its default value to[255, 255, 255, 255](white) instead ofnull.
Bug Description
When calling noTint() before rendering a framebuffer, the following error was thrown:
Uncaught TypeError: Cannot read properties of null (reading 'slice')
This happened due to how noTint() was modifying the tint uniform value, causing the shader pipeline to fail when rendering framebuffers.
Root Cause:
noTint()was setting the tint value tonull.- The shader uniform system attempted to slice the
nullvalue, resulting in an error. - This error prevented framebuffers from being rendered correctly.
Fix Implementation
The following changes were made to resolve the issue:
Updated noTint() Implementation
- Instead of setting
tinttonull, it now defaults to[255, 255, 255, 255](white). - This ensures valid uniform data is always provided to the shader.
Testing & Verification
Manual Testing
- Verified that calling
noTint()no longer causes framebuffer rendering to fail. - Confirmed that all tint-related operations function correctly.
Automated Testing
- Updated unit tests to validate correct behavior when
noTint()is applied before rendering framebuffers.
PR Checklist
- [x]
npm run lintpasses - [x] Inline reference is included/updated
- [x] Unit tests are included/updated