
    Ui	                     0    S SK 7  S SK7    " S S\5      rg)    )*c                   R    \ rS rSrSrSS jrS rS rS rS r	S r
S	 rS
 rS rSrg)GlutApp   zbGlutApp uses freeglut library to create an opengl context, listen to keyboard events, and clean upc                 J    Xl         X l        SU l        U R                  5         g)zECreates an OpenGL context and a window, and acquires OpenGL resourcesN)renderertitlewindowinit_gl)selfr   r	   s      U/home/james-whalen/.local/lib/python3.13/site-packages/openvr/glframework/glut_app.py__init__GlutApp.__init__   s     
    c                     U $ )z#setup for RAII using 'with' keyword r   s    r   	__enter__GlutApp.__enter__   s    r   c                 $    U R                  5         g)z%cleanup for RAII using 'with' keywordN)
dispose_gl)r   type_argvalue	tracebacks       r   __exit__GlutApp.__exit__   s    r   c                    [        5         [        [        [        -  [        -  5        [        [        5      (       a  [        SS5        [        SS5        [        SS5        [        U R                  5      U l        [        U R                  5        [        U R                  5        [        U R                   5        [#        U R$                  5        U R&                  b  U R&                  R)                  5         g g )N      i   iX  2   )glutInitglutInitDisplayMode	GLUT_RGBA
GLUT_DEPTHGLUT_SINGLEboolglutInitContextVersionglutInitWindowSizeglutInitWindowPositionglutCreateWindowr	   r
   glutDisplayFuncrender_sceneglutIdleFuncglutReshapeFunc	resize_glglutKeyboardFunc	key_pressr   r   r   s    r   r   GlutApp.init_gl   s    
I
2[@A&''"1a(3$r2&&tzz2))*T&&''(==$MM!!# %r   c                 L    U R                   R                  5         [        5         g)zrender scene one timeN)r   r,   glFlushr   s    r   r,   GlutApp.render_scene0   s    ""$	r   c                     U R                   b.  U R                  b  U R                  R                  5         S U l         SU l        g )NF)r
   r   r   _is_initializedr   s    r   r   GlutApp.dispose_gl6   s5    ;;"}}(((*DK$r   c                 v    [        U5      S:X  a*  [        [        5      (       a  [        5         g[        S5      eg)z4Close the application when the player presses ESCAPE   zApplication quitN)ordr&   glutLeaveMainLoop	Exception)r   keyxys       r   r1   GlutApp.key_press=   s0    s8r>%&&!# 233 r   c                     [        SSX5        g)z1Called every time the on-screen window is resizedr   N)
glViewport)r   widthheights      r   r/   GlutApp.resize_glF   s    1a'r   c                     [        5         g)z'keep rendering until the user says quitN)glutMainLoopr   s    r   run_loopGlutApp.run_loopJ   s    r   )r7   r   r	   r
   N)s	   GLUT test)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r,   r   r1   r/   rI   __static_attributes__r   r   r   r   r      s2    h$"%4(r   r   N)	OpenGL.GLOpenGL.GLUTobjectr   r   r   r   <module>rT      s   
  
?f ?r   