File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -726,7 +726,10 @@ export class AdvancedDynamicTexture extends DynamicTexture {
726
726
const engine = scene . getEngine ( ) ;
727
727
if ( this . adjustToEngineHardwareScalingLevel ) {
728
728
// force the renderScale to the engine's hardware scaling level
729
- this . _renderScale = 1 / engine . getHardwareScalingLevel ( ) ;
729
+ this . _renderScale = engine . getHardwareScalingLevel ( ) ;
730
+ // calculate the max renderScale, based on the max texture size of engine.getCaps().maxTextureSize (enforced by some mobile devices)
731
+ this . _renderScale =
732
+ 1 / Math . max ( this . _renderScale , engine . getRenderWidth ( ) / engine . getCaps ( ) . maxTextureSize , engine . getRenderHeight ( ) / engine . getCaps ( ) . maxTextureSize ) ;
730
733
}
731
734
const textureSize = this . getSize ( ) ;
732
735
let renderWidth = engine . getRenderWidth ( ) * this . _renderScale ;
@@ -744,7 +747,8 @@ export class AdvancedDynamicTexture extends DynamicTexture {
744
747
if ( textureSize . width !== renderWidth || textureSize . height !== renderHeight ) {
745
748
this . scaleTo ( renderWidth , renderHeight ) ;
746
749
if ( this . adjustToEngineHardwareScalingLevel ) {
747
- const scale = this . _renderScale * this . _renderScale ;
750
+ const engineRenderScale = 1 / engine . getHardwareScalingLevel ( ) ;
751
+ const scale = this . _renderScale * engineRenderScale ;
748
752
this . _rootContainer . scaleX = scale ;
749
753
this . _rootContainer . scaleY = scale ;
750
754
this . _rootContainer . widthInPixels = renderWidth / scale ;
You can’t perform that action at this time.
0 commit comments