aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-03-28 02:05:05 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-03-28 02:05:05 -0400
commit29398e67039acc75f40c1797e1909b943b9a5852 (patch)
tree99900a0d783c50f7ee28adae90a23b733e09edee /src
parentaec690968a0ad143116b449215b16f76030db194 (diff)
Fix GLUT frame display
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]();
},
};