phetsims / energy-skate-park-basics

"Energy Skate Park: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/energy-skate-park-basics
GNU General Public License v3.0
2 stars 9 forks source link

Darkened Pie Chart When Skater is Underground #430

Closed KatieWoe closed 6 years ago

KatieWoe commented 6 years ago

Test device: Dell Laptop Operating System: Windows 10 Browser: Chrome 67.0.3396.99 Problem description: For phetsims/QA/issues/134 Possibly related to phetsims/energy-skate-park-basics/issues/177 It is possible to make the skater skate fully underground while they are still on the track. If this happens while the Pie Chart checkbox is selected, the pie chart will darken partially or entirely while the skater is underground. Steps to reproduce:

  1. Go to the Playground Screen
  2. Build a track that will have the skater go upside down near the ground. You should be able to force this track fully underground, such as in phetsims/energy-skate-park-basics/issues/417
  3. Put the skater in slow motion and start them at the top of the track
  4. Before the skater reaches the upside down track near the ground, drag a point of the track down so it is underground. Do not let go of the track while this happens, or it will not stay underground.

Screenshots: dark graph

Troubleshooting information (do not edit):

Name: ‪Energy Skate Park: Basics‬ URL: https://phet-dev.colorado.edu/html/energy-skate-park-basics/1.4.0-dev.1/phet/energy-skate-park-basics_en_phet.html Version: 1.4.0-dev.1 2018-06-20 00:09:06 UTC Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Language: en-US Window: 1536x741 Pixel Ratio: 2.5/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 4096 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {"assert":{"sha":"928741cf","branch":"master"},"axon":{"sha":"f0522e7c","branch":"master"},"brand":{"sha":"89d28f63","branch":"master"},"chipper":{"sha":"e8946524","branch":"master"},"dot":{"sha":"6482f8c9","branch":"master"},"energy-skate-park-basics":{"sha":"288fcefd","branch":"master"},"joist":{"sha":"22e437d5","branch":"master"},"kite":{"sha":"a1086efc","branch":"master"},"phet-core":{"sha":"17326041","branch":"master"},"phet-io":{"sha":"3ea0727a","branch":"master"},"phet-io-wrapper-classroom-activity":{"sha":"53708616","branch":"master"},"phet-io-wrapper-hookes-law-energy":{"sha":"8a546a32","branch":"master"},"phet-io-wrapper-lab-book":{"sha":"1527afd6","branch":"master"},"phet-io-wrappers":{"sha":"8d814eab","branch":"master"},"phetcommon":{"sha":"6ec8cd89","branch":"master"},"query-string-machine":{"sha":"4182612f","branch":"master"},"scenery":{"sha":"88cb642e","branch":"master"},"scenery-phet":{"sha":"7bcde0b2","branch":"master"},"sherpa":{"sha":"88c3b828","branch":"master"},"sun":{"sha":"7579e8fa","branch":"master"},"tandem":{"sha":"8461b6f3","branch":"master"}}
phet-steele commented 6 years ago

@KatieWoe @samreid @jessegreenberg I swore I logged this like a year ago, but apparently not, so thanks! The associated warning shows this is due to WebGL:

[.Offscreen-For-WebGL-000001654EB152F0]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to access out of range vertices in attribute 0
jessegreenberg commented 6 years ago

In these cases in PieChargeWebGLSliceNode.paint, numToDraw is 1009 and this.vertices.length is 2004, but this.vertices is a flat array of x and y values, and WebGL moves through them 2 at a time, so I think that numToDraw must be less than this.vertices.length / 2 to work correctly.

We could limit the value in PieChargeWebGLSliceNode.paint, or maybe there is a better way in PieChartWebGLNode?

I am also not sure if the skater should ever go below the ground, see #432. But this is happening when Skater.positionProperty.get().y is negative, so this would come up again when the potential energy reference can change.

jessegreenberg commented 6 years ago

I verified that this line of code near the numToDraw calculation in PieChartWebGLSliceNode makes the warning go away:

      numToDraw = Math.min( numToDraw, this.vertices.length / 2 );

But we are still running into a case with negative potential energy, which will need to be address in #432.

jessegreenberg commented 6 years ago

@KatieWoe can you please verify that the original issue has been fixed?

KatieWoe commented 6 years ago

Looks good on Master.

jessegreenberg commented 6 years ago

Thanks!