window.devicePixelRatio support?
See original GitHub issueI’m struggling to decide whether three.js should handle window.devicePixelRatio internally or not.
This would mean adding this kind of code to each renderer:
var ratio = window.devicePixelRatio || 1;
canvas.width = width * ratio;
canvas.height = height * ratio;
canvas.style.width = width + 'px';
canvas.style.height = height + 'px';
The good thing is that people wouldn’t have to worry about having to implement it on their end. But I don’t know what the bad things would be. I’m sure this could lead to some confusion at some point.
Issue Analytics
- State:
- Created 11 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Window.devicePixelRatio | Can I use... Support ... - CanIUse
Read-only property that returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of...
Read more >Window.devicePixelRatio - Web APIs | MDN
The devicePixelRatio of Window interface returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the ...
Read more >Browser Compatibility of Window.devicePixelRatio on Safari 15
devicePixelRatio is Fully Supported on Safari 15, which means that any user who'd be accessing your page through Safari 15 can see it...
Read more >window.devicePixelRatio browser support - Stack Overflow
1 Answer 1 · window.devicePixelRatio is mostly trustworthy on most browsers. · On iOS devices, multiply devicePixelRatio by screen.width to get ...
Read more >Support table - device pixel ratio.md - GitHub Gist
Device OS OS version Browser Browser version Device pixel ratio
Apple iPad 5th iOS 11.0.3 Mobile Safari 11.0 2
Apple iPad Air 2 iOS 8.4...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

😊
MY FACE WHEN I DISCOVERED renderer.setPixelRatio(1)
Thanks Ricardo for talking about this! That small detail by itself made my 3D FPS implementation achieve almost 60fps without changing anything else. Incredibly useful for mobile devices and horrible laptop GPU’s.