Skip to content

Properly support device pixel ratio in CesiumJS shared context system #12762

@markschlosseratbentley

Description

@markschlosseratbentley

Feature

For context, see #12635 (comment) on #12635.

As part of some future work related to that PR, we need to consider how to best support device pixel ratio in the case of querying viewport dimensions in CesiumJS when using the shared contexts that PR introduces.

The section of code this is concerned with is here:

// ###TODO: When will this be inaccurate? device pixel ratio? Canvas larger than maximum drawing buffer dimensions supported by WebGL implementation?

@ggetz mentions:

The max viewport dimensions are available in ContextLimits.maximumViewportWidth/ContextLimits.maximumViewportHeight.

Pixel ratio is less straightforward, as it's "owned" by Scene.frameState. Perhaps it should live in Context instead.

@pmconne mentions:

As discussed KhronosGroup/WebGL#2460, pixel ratio is tricky and not 100% solved. An w3c/csswg-drafts#4476 to obtain the dimensions of a canvas (or other element) in integer device pixels solves the problem, except it's not yet supported in Safari.

iTwin.js attempts to account for DPR here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions