Show More
@@ -326,32 +326,33 b' class InputHookManager(object):' | |||||
326 | the GLUT to integrate with terminal based applications like |
|
326 | the GLUT to integrate with terminal based applications like | |
327 | IPython. |
|
327 | IPython. | |
328 |
|
328 | |||
329 |
GLUT is |
|
329 | GLUT is quite an old library and it is difficult to ensure proper | |
330 | integration within IPython since original GLUT does not allow to handle |
|
330 | integration within IPython since original GLUT does not allow to handle | |
331 | events one by one. Instead, it requires for the mainloop to be entered |
|
331 | events one by one. Instead, it requires for the mainloop to be entered | |
332 | and never returned (there is not event a function to exit he |
|
332 | and never returned (there is not event a function to exit he | |
333 | mainloop). Fortunately, there are alternatives such as freeglut |
|
333 | mainloop). Fortunately, there are alternatives such as freeglut | |
334 |
(avai |
|
334 | (available for linux and windows) and the OSX implementation gives | |
335 | access to a glutCheckLoop() function that blocks itself until a new |
|
335 | access to a glutCheckLoop() function that blocks itself until a new | |
336 | event is received. This means we have to setup a default timer to |
|
336 | event is received. This means we have to setup a default timer to | |
337 | ensure we got at least one event that will unblock the function. |
|
337 | ensure we got at least one event that will unblock the function. We set | |
|
338 | a default timer of 60fps. | |||
338 |
|
339 | |||
339 |
Furthermore, it is not possible to install these handlers wi |
|
340 | Furthermore, it is not possible to install these handlers without a | |
340 |
window being first created. We choose to make this window visible |
|
341 | window being first created. We choose to make this window invisible and | |
341 | the user to realize that it does not need to create a new one (or this |
|
342 | the user is supposed to akeit visible when needed (see gui-glut.py in | |
342 | will bring troubles). But, display mode options are then set here and |
|
343 | the docs/examples/lib directory). This means that display mode options | |
343 | it won't be possible for the user to change them without modifying the |
|
344 | are set ath this level and user won't be able to change them later | |
344 | code or this has to be made availble via IPython options system. |
|
345 | without modifying the code. This should probably be made available via | |
|
346 | IPython options system. | |||
345 |
|
347 | |||
346 | Script integration |
|
348 | Script integration | |
347 | ------------------ |
|
349 | ------------------ | |
348 |
|
350 | |||
349 | :: |
|
|||
350 |
|
||||
351 | interactive = False |
|
|||
352 | if glut.glutGetWindow() > 0: |
|
351 | if glut.glutGetWindow() > 0: | |
353 | interactive = True |
|
352 | interactive = True | |
|
353 | glut.glutShowWindow() | |||
354 | else: |
|
354 | else: | |
|
355 | interactive = False | |||
355 | glut.glutInit(sys.argv) |
|
356 | glut.glutInit(sys.argv) | |
356 | glut.glutInitDisplayMode( glut.GLUT_DOUBLE | |
|
357 | glut.glutInitDisplayMode( glut.GLUT_DOUBLE | | |
357 | glut.GLUT_RGBA | |
|
358 | glut.GLUT_RGBA | | |
@@ -421,7 +422,7 b' class InputHookManager(object):' | |||||
421 | # to change it later |
|
422 | # to change it later | |
422 | glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH) |
|
423 | glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH) | |
423 | glut.glutCreateWindow(sys.argv[0]) |
|
424 | glut.glutCreateWindow(sys.argv[0]) | |
424 | glut.glutReshapeWindow(1,1) |
|
425 | # glut.glutReshapeWindow(1,1) | |
425 | glut.glutHideWindow() |
|
426 | glut.glutHideWindow() | |
426 | glut.glutDisplayFunc(display) |
|
427 | glut.glutDisplayFunc(display) | |
427 | glut.glutTimerFunc( int(1000.0/fps), timer, fps) |
|
428 | glut.glutTimerFunc( int(1000.0/fps), timer, fps) |
General Comments 0
You need to be logged in to leave comments.
Login now