Jump to content

Retina Display Laptop & Mobile


Recommended Posts

Dear Forum

 I found the babylonjs models on my computer don't look not as good as on the iphone, so i tested the resolution:


Macbook 12" (2304 x 1440px):

Pixel ratio: 1

render height: 714

canvas height: 714

window.devicePixelRatio: 2


iphone 8 4.7":

PixelRatio: 1

RenderHeight: 1393

CanvasHeight: 1393

window.devicePixelRatio: 2



so my iphone is haft the physical size and double the screen resolution, thats absurd no? Is it possible that the retina display of my macbook was not recogniced by the browser? 

i tried:

var scene = new BABYLON.Scene(engine);


but nothing changes. Is there a way to detect all retina displays and boost the resolution?





Link to comment
Share on other sites

8 hours ago, F3/*X said:

Is there a way to detect all retina displays and boost the resolution?

Hi F3/*X - Welcome to the forum!!  There's an optional 4th parameter when you create the engine to do this automatically.  It defaults to false.

The code in the Engine constructor that handles this for you is here:

const devicePixelRatio = Tools.IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;

var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;
this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;

If you don't set adaptToDeviceRatio to true in Engine constructor, then you may want to account for other devicePixelRatios.  I am on a laptop right now with a devicePixelRatio of 2.5 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...