BabylonJS / BabylonJS/BabylonNative

Resolution, DPI and Graphics

Open
#1,016 0 comments 0 reactions 0 assignees View on GitHub
rendering
Dominant language
C++
Stars
919
Forks
162
Avg merge
1d 15h
Merged PRs (30d)
19

Description

Related PR : https://github.com/BabylonJS/BabylonNative/pull/1003
Related issues : https://github.com/BabylonJS/BabylonNative/issues/1000 https://github.com/BabylonJS/BabylonNative/issues/65

Resolution and DPI are lacking consistency in the API contract.
On iOS, the back buffer must be in the logical coordinate system (scaled down by the pixel scale). The computation is done in the bridge.
On Android, all coordinates (window size, inputs) are in native coordinates and scaled down by the PR mentioned previously.
For UWP, computation is also done in the app.

We want to automate these computation in Core/Graphics and hide it from the user app.
One possibility is to only provide a nativeWindow, retrieve the size, scale it and use it when creating the backbuffer.

The `windowConfiguration` would only need the native window, all references to width and height would be removed.
https://github.com/BabylonJS/BabylonNative/blob/e4a4d882af22768d2226fd1f2e178b46a20a1af3/Core/Graphics/Include/Platform/Unix/Babylon/GraphicsPlatform.h#L11
Same for update, CoreGraphics would be responsible to retrieve the new dimension when the window is updated
https://github.com/BabylonJS/BabylonNative/blob/e4a4d882af22768d2226fd1f2e178b46a20a1af3/Core/Graphics/Include/Shared/Babylon/Graphics.h#L67

Questions:
- Shall we have a template when creating `Graphics` instead of a generic object?
- What happens when using a NativeContext instead of a Native Window?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.