aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-04-05 02:43:44 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-04-05 02:43:44 -0400
commit003437333779e0042eb3bf87c698e326c5312208 (patch)
treedd001f2e703990a82c12dc307a040d3fc851db86
parentca4340eae0091a1cc823048bedee4adbf7678bbf (diff)
Fix canvas resize in glutFullScreen()
-rw-r--r--src/library_glut.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/library_glut.js b/src/library_glut.js
index 0ec8c6c5..c46256db 100644
--- a/src/library_glut.js
+++ b/src/library_glut.js
@@ -378,6 +378,7 @@ var LibraryGLUT = {
return 1;
},
+ glutReshapeWindow__deps: ['$GLUT', 'glutPostRedisplay'],
glutReshapeWindow: function(width, height) {
GLUT.cancelFullScreen();
Module['canvas'].width = width;
@@ -388,15 +389,27 @@ var LibraryGLUT = {
_glutPostRedisplay();
},
+ glutPositionWindow__deps: ['$GLUT', 'glutPostRedisplay'],
glutPositionWindow: function(x, y) {
GLUT.cancelFullScreen();
/* TODO */
_glutPostRedisplay();
},
+ glutFullScreen__deps: ['$GLUT', 'glutPostRedisplay'],
glutFullScreen: function() {
+ var width = screen.width;
+ var height = screen.height;
+ /* Can't call _glutReshapeWindow as that requests cancelling fullscreen. */
+ Module['canvas'].width = width;
+ Module['canvas'].height = height;
+ if (GLUT.reshapeFunc) {
+ FUNCTION_TABLE[GLUT.reshapeFunc](width, height);
+ }
GLUT.requestFullScreen();
- _glutReshapeWindow(Module['canvas'].clientWidth, Module['canvas'].clientHeight);
+ window.setTimeout(function() {
+ _glutPostRedisplay();
+ }, 0);
},
glutInitDisplayMode: function(mode) {},