Index: cocos/director.py
===================================================================
--- cocos/director.py	(revision 864)
+++ cocos/director.py	(working copy)
@@ -477,7 +477,14 @@
         width, height = self.window.width, self.window.height
         ow, oh = self.get_window_size()
 
-        glViewport(0, 0, width, height)
+        if (1.* width / height) > self._window_aspect:
+            width = int(height * self._window_aspect)
+        if (1.* width / height) < self._window_aspect:
+            height = int(width * 1/self._window_aspect)
+
+        self._offset_x = (self.window.width - width) // 2
+        self._offset_y = (self.window.height - height) //2
+        glViewport(self._offset_x, self._offset_y, width, height)
         glMatrixMode(GL_PROJECTION)
         glLoadIdentity()
         gluPerspective(60, 1.0*width/height, 0.1, 3000.0)
