Show More
@@ -312,26 +312,28 class InputHookManager(object): | |||||
312 | """ |
|
312 | """ | |
313 |
|
313 | |||
314 | import OpenGL.GLUT as glut |
|
314 | import OpenGL.GLUT as glut | |
315 |
from IPython.lib.inputhookglut import |
|
315 | from IPython.lib.inputhookglut import glut_display_mode, \ | |
|
316 | glut_close, glut_display, \ | |||
|
317 | glut_idle, inputhook_glut | |||
316 |
|
318 | |||
317 | if not self._apps.has_key(GUI_GLUT): |
|
319 | if not self._apps.has_key( GUI_GLUT ): | |
318 | glut.glutInit(sys.argv) |
|
320 | glut.glutInit( sys.argv ) | |
319 | glut.glutInitDisplayMode(glut_display_mode) |
|
321 | glut.glutInitDisplayMode( glut_display_mode ) | |
320 | # This is specific to freeglut |
|
322 | # This is specific to freeglut | |
321 | if bool(glut.glutSetOption): |
|
323 | if bool(glut.glutSetOption): | |
322 | glut.glutSetOption(glut.GLUT_ACTION_ON_WINDOW_CLOSE, |
|
324 | glut.glutSetOption( glut.GLUT_ACTION_ON_WINDOW_CLOSE, | |
323 | glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS) |
|
325 | glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS ) | |
324 | glut.glutCreateWindow(sys.argv[0]) |
|
326 | glut.glutCreateWindow( sys.argv[0] ) | |
325 | glut.glutReshapeWindow( 1, 1 ) |
|
327 | glut.glutReshapeWindow( 1, 1 ) | |
326 | glut.glutHideWindow() |
|
328 | glut.glutHideWindow( ) | |
327 | glut.glutWMCloseFunc(glut_close) |
|
329 | glut.glutWMCloseFunc( glut_close ) | |
328 | glut.glutDisplayFunc(glut_display) |
|
330 | glut.glutDisplayFunc( glut_display ) | |
329 | glut.glutIdleFunc( glut_idle) |
|
331 | glut.glutIdleFunc( glut_idle ) | |
330 | else: |
|
332 | else: | |
331 | glut.glutWMCloseFunc(glut_close) |
|
333 | glut.glutWMCloseFunc( glut_close ) | |
332 | glut.glutDisplayFunc(glut_display) |
|
334 | glut.glutDisplayFunc( glut_display ) | |
333 | glut.glutIdleFunc( glut_idle) |
|
335 | glut.glutIdleFunc( glut_idle) | |
334 | self.set_inputhook(inputhook_glut) |
|
336 | self.set_inputhook( inputhook_glut ) | |
335 | self._current_gui = GUI_GLUT |
|
337 | self._current_gui = GUI_GLUT | |
336 | self._apps[GUI_GLUT] = True |
|
338 | self._apps[GUI_GLUT] = True | |
337 |
|
339 | |||
@@ -343,7 +345,8 class InputHookManager(object): | |||||
343 | dummy one and set the timer to a dummy timer that will be triggered |
|
345 | dummy one and set the timer to a dummy timer that will be triggered | |
344 | very far in the future. |
|
346 | very far in the future. | |
345 | """ |
|
347 | """ | |
346 | from glut_support import * |
|
348 | import OpenGL.GLUT as glut | |
|
349 | from glut_support import glutMainLoopEvent | |||
347 |
|
350 | |||
348 | glut.glutHideWindow() # This is an event to be processed below |
|
351 | glut.glutHideWindow() # This is an event to be processed below | |
349 | glutMainLoopEvent() |
|
352 | glutMainLoopEvent() |
General Comments 0
You need to be logged in to leave comments.
Login now