Skip to content

Commit

Permalink
disable webgl on mobile safari, #182
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jun 14, 2024
1 parent b57fef4 commit 07a4fef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/common/FELSim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ElectromagnetScreen from '../electromagnet/ElectromagnetScreen.js';
import TransformerScreen from '../transformer/TransformerScreen.js';
import GeneratorScreen from '../generator/GeneratorScreen.js';
import FELPreferences from './model/FELPreferences.js';
import platform from '../../../phet-core/js/platform.js';

type FELScreen = BarMagnetScreen | PickupCoilScreen | ElectromagnetScreen | TransformerScreen | GeneratorScreen;

Expand All @@ -28,7 +29,13 @@ export default class FELSim extends Sim {
preferences: FELPreferences ) {

super( titleStringProperty, screens, {
webgl: true, // Enabled for high-performance scenery.Sprites

// WebGL is typically enabled for high-performance scenery.Sprites, which are used heavily by this sim.
// On iPadOS, the sim consistently crashed when WebGL was enabled, and we were unable to determine why.
// Disabling WebGL uses Canvas as the fallback for Sprites. The problem was not present on iOS, but we
// have no way to differentiate between Safari on iPadOS vs iOS, so WebGL is disabled on both platforms.
// See https://github.com/phetsims/faradays-electromagnetic-lab/issues/182.
webgl: !platform.mobileSafari,

// Remove ScreenViews that are not active, to minimize WebGL contexts, see https://github.com/phetsims/faradays-electromagnetic-lab/issues/153
detachInactiveScreenViews: true,
Expand Down

0 comments on commit 07a4fef

Please sign in to comment.