jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.27k stars 454 forks source link

Improve Blurry Texture Rendering in WebGLRenderer #718

Closed jonobr1 closed 6 months ago

jonobr1 commented 6 months ago

Reported by @benz2012:

This PR improves blurry textures by appropriately scaling uploaded textures to the GPU by the renderer's pixel density.

Before After
Screenshot 2024-02-21 at 10 20 27 PM Screenshot 2024-02-21 at 10 19 42 PM

For a scene such as:

const two = new Two({
  type: Two.Types.webgl,
  fullscreen: true,
  autostart: true
}).appendTo(document.body);

const params = {
  size: 100,
  fill: '#000',
  stroke: '#00aeff',
  linewidth: 3,
  weight: 'bold'
};
const text = two.makeText('Hello World', two.width / 2, two.height / 2, params);