aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index a2e7ee85..dfab1fc2 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -646,31 +646,29 @@ var LibraryGLUT = {
glutInitDisplayMode: function(mode) {},
glutSwapBuffers: function() {},
- getRAF: function() {
- var RAF = window['setTimeout'];
- if (window['requestAnimationFrame']) {
- RAF = window['requestAnimationFrame'];
- } else if (window['mozRequestAnimationFrame']) {
- RAF = window['mozRequestAnimationFrame'];
- } else if (window['webkitRequestAnimationFrame']) {
- RAF = window['webkitRequestAnimationFrame'];
- } else if (window['msRequestAnimationFrame']) {
- RAF = window['msRequestAnimationFrame'];
- }
- return RAF;
- },
-
glutPostRedisplay: function() {
- if (GLUT.displayFunc)
- GLUT.getRAF().apply(window, [FUNCTION_TABLE[GLUT.displayFunc]]);
+ if (GLUT.displayFunc) {
+ var RAF = window['setTimeout'];
+ if (window['requestAnimationFrame']) {
+ RAF = window['requestAnimationFrame'];
+ } else if (window['mozRequestAnimationFrame']) {
+ RAF = window['mozRequestAnimationFrame'];
+ } else if (window['webkitRequestAnimationFrame']) {
+ RAF = window['webkitRequestAnimationFrame'];
+ } else if (window['msRequestAnimationFrame']) {
+ RAF = window['msRequestAnimationFrame'];
+ }
+ RAF.apply(window, [FUNCTION_TABLE[GLUT.displayFunc]]);
+ }
},
+ glutMainLoop__deps: ['$GLUT'],
glutMainLoop: function() {
if (GLUT.reshapeFunc) {
FUNCTION_TABLE[GLUT.reshapeFunc](Module['canvas'].width,
Module['canvas'].height);
}
- GLUT.glutPostRedisplay();
+ FUNCTION_TABLE[GLUT.glutPostRedisplay]();
},
};