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

WebGL setAttributes causes image interpolation to default to LINEAR #7304

Open
1 of 17 tasks
RandomGamingDev opened this issue Oct 10, 2024 · 1 comment
Open
1 of 17 tasks

Comments

@RandomGamingDev
Copy link
Contributor

RandomGamingDev commented Oct 10, 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

Web browser and version

129.0.6668.58 & 115.15.0esr

Operating system

Debian 12

Steps to reproduce this

Steps:

  1. Call setAttributes
  2. setInterpolation on a texture to NEAREST
  3. Render the texture and watch it not work

Example (working sketch located at https://editor.p5js.org/PotatoBoy/sketches/tFXOSAnZV):

let img;
let canvas;

function preload() {
  img = loadImage('test.png');
}

function setup() {
  canvas = createCanvas(400, 400, WEBGL);
  setAttributes({ alpha: true });

  canvas.getTexture(img).setInterpolation(NEAREST, NEAREST);
}

function draw() {
  background(0);
  image(img, -width / 2, -height / 2, width, height);
}

Result:
image
Expected Result:
image

Note: Related to #6325 which is encompassed by this issue

@RandomGamingDev
Copy link
Contributor Author

Calling _renderer.getTexture(img).setInterpolation(NEAREST, NEAREST); fixes it for both Chrome and Firefox unlike #6325 where it only fixes it for Chrome and Firefox works by default.

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

1 participant