phetsims / neuron

"Neuron" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

Fails to run on iPad running iOS7 #41

Closed jbphet closed 9 years ago

jbphet commented 9 years ago

The current version does not load on iOS 7, probably due to the fact that there is no support for WebGL. This can be reproduced on the current dev version, which is available here: http://www.colorado.edu/physics/phet/dev/html/neuron/1.0.0-dev.5/neuron_en.html. When this is run tethered to a Mac, I can see the message "Error: Unable to load WebGL".

I believe that Energy Skate Park Basics, which is currently the only other PhET sim that is making use of WebGL, added some code for falling back to canvas or other rendering methods if WebGL was not available. This will likely be needed for this sim as well.

I will assign to @AshrafSharf now, but will also ask @samreid to chime in, since he has some relevant experience in this area.

jbphet commented 9 years ago

I discussed this with @samreid, asking specifically about how the fallback was done in Energy Skate Park Basics. He suggested looking at line 291 of EnergySkateParkBasicsScreenView.js. A key portion of the code is excerpted here:

   // Check to see if WebGL was prevented by a query parameter
    var allowWebGL = window.phetcommon.getQueryParameter( 'webgl' ) !== 'false';

    var webGLSupported = Util.isWebGLSupported && allowWebGL;

    // Use WebGL where available, but not on IE, due to https://github.com/phetsims/energy-skate-park-basics/issues/277
    // and https://github.com/phetsims/scenery/issues/285
    var renderer = webGLSupported ? 'webgl' : 'svg';
   .
   .
   .
samreid commented 9 years ago

You will probably also need to add some logic like:

var node = isWebGLSupported ? new WebGLNeuronNode() : new NeuronNode();

Or whatever kind of node it is.

AshrafSharf commented 9 years ago

Canvas based Particle implementation is added in case WebGL support is not available. Used the JavaScript snippet provided in the preceding comments to check for WebGL support. Tested with webgl=false query parameter.

jbphet commented 9 years ago

The fallback works when tested on an iPad 2, iOS version 7.0.4 (11B554a), but performance is slow, achieving around 25 fps when idle, and about 15fps when an action potential is in progress at the membrane cross section.

jbphet commented 9 years ago

I've created another issue about potentially needing optimization to run well on iPads, see #55. Optimization work will be tracked there. Since the problem that was originally reported here about the lack of canvas fallback has been resolved, this issue is being closed.