diff options
-rw-r--r-- | src/library_glut.js | 5 | ||||
-rw-r--r-- | tests/hello_world_gles.c | 12 | ||||
-rw-r--r-- | tests/test_browser.py | 3 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/library_glut.js b/src/library_glut.js index 167e5272..445e08a4 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -22,6 +22,7 @@ var LibraryGLUT = { windowY: 0, windowWidth: 0, windowHeight: 0, + requestedAnimationFrame: false, saveModifiers: function(event) { GLUT.modifiers = 0; @@ -484,8 +485,10 @@ var LibraryGLUT = { glutSwapBuffers: function() {}, glutPostRedisplay: function() { - if (GLUT.displayFunc) { + if (GLUT.displayFunc && !GLUT.requestedAnimationFrame) { + GLUT.requestedAnimationFrame = true; Browser.requestAnimationFrame(function() { + GLUT.requestedAnimationFrame = false; if (ABORT) return; Runtime.dynCall('v', GLUT.displayFunc); }); diff --git a/tests/hello_world_gles.c b/tests/hello_world_gles.c index 78595a49..f05cf052 100644 --- a/tests/hello_world_gles.c +++ b/tests/hello_world_gles.c @@ -547,6 +547,10 @@ gears_draw(void) draw_gear(gear3, transform, -3.1, 4.2, -2 * angle - 25.0, blue); glutSwapBuffers(); + +#ifdef LONGTEST + glutPostRedisplay(); // check for issues with not throttling calls +#endif } /** @@ -621,6 +625,14 @@ gears_idle(void) fps); tRate0 = t; frames = 0; +#ifdef LONGTEST + static runs = 0; + runs++; + if (runs == 4) { + int result = fps; + REPORT_RESULT(); + } +#endif } } diff --git a/tests/test_browser.py b/tests/test_browser.py index f34a2d98..dfb1ef69 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1386,6 +1386,9 @@ keydown(100);keyup(100); // trigger the end args=['-DHAVE_BUILTIN_SINCOS'], outfile='something.html', message='You should see animating gears.') + def test_glgears_long(self): + self.btest('hello_world_gles.c', expected=map(str, range(30, 1000)), args=['-DHAVE_BUILTIN_SINCOS', '-DLONGTEST']) + def test_glgears_animation(self): es2_suffix = ['', '_full', '_full_944'] for full_es2 in [0, 1, 2]: |