greggman / twgl.js

A Tiny WebGL helper Library
http://twgljs.org
MIT License
2.67k stars 260 forks source link

multiplier equal to devicePixelRatio by default #100

Closed munrocket closed 5 years ago

munrocket commented 5 years ago

This is the proposed improvement without builddocs and build process.

As you know we have a problem with retina devices. Without passing multiplier=window.devicePixelRatio picture become blurry on iOS.

Also bitwise operator or is removed, because why not.

greggman commented 5 years ago

Doing that automatically is a very bad idea. It can lead to all kinds of bugs and is why it's not automatic.

munrocket commented 5 years ago

But it works and devicePixelRatio support bigger than WebGL https://caniuse.com/#feat=devicepixelratio

munrocket commented 5 years ago

Here source examples from REGL: https://github.com/regl-project/regl/search?utf8=✓&q=devicepixelratio&type=

greggman commented 5 years ago

No, it doesn't work.

There are plenty of cases where using devicePixelRatio automagically under the hood will break programs. I've fixed several by other users

Here's a tiny example

http://jsfiddle.net/greggman/swhfz5ma/

Using devicePixelRatio is something the user should opt into so they can deal with the issues rather that have the library try to do magic and have the developer have no idea their code will break.

munrocket commented 5 years ago

Thanks for explanation.