
    3j3                     R    S r SSKrSSKrSSKJrJr   " S S\R                  5      rg)z%EGL (cross-platform) platform library    N)baseplatformctypesloaderc                     ^  \ rS rSrSr\R                  S 5       r\R                  S 5       r\R                  S 5       r	\R                  S 5       r
\R                  S 5       r\R                  S 5       r\R                  S	 5       r\R                  S
 5       r\R                  S 5       r\R                  S 5       r\" \R&                  5      r\R                  S 5       rS rU 4S jrSrU =r$ )EGLPlatform   z)EGL platform for opengl-es only platformsc                      [         R                  " [        R                  S[        R                  S9$ ! [
         a     g f = f)N	GLESv1_CMmoder   loadLibraryctypescdllRTLD_GLOBALOSErrorselfs    M/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/platform/egl.pyGLES1EGLPlatform.GLES1   sA    	++'' 
  		   14 
A Ac                      [         R                  " [        R                  S[        R                  S9$ ! [
         a     g f = f)NGLESv2r
   r   r   s    r   GLES2EGLPlatform.GLES2   sA    	++'' 
  		r   c                     U R                   $ N)r   r   s    r   GLES3EGLPlatform.GLES3   s     zz    c                     S H@  n[         R                  " [        R                  U[        R                  S9nU(       d  M>  Us  $    [        S5      e! [
         a"    U R                  =(       d    U R                  s $ f = f)N)OpenGLGLr
   zNo GL/OpenGL library available)r   r   r   r   r   r   r   r   )r   namelibs      r   r#   EGLPlatform.GL   sp    	,'"..KK++
 3J ( :;; 	,::++	,s   <A A A )A?>A?c                      [         R                  " [        R                  S[        R                  S9$ ! [
         a     g f = f)NGLUr
   r   r   s    r   r(   EGLPlatform.GLU-   A    	++'' 
  		r   c                      [         R                  " [        R                  S[        R                  S9$ ! [
         a     g f = f)Nglutr
   r   r   s    r   GLUTEGLPlatform.GLUT7   sA    	++'' 
  		r   c                     U R                   $ r   )r#   r   s    r   r"   EGLPlatform.OpenGLA   s    !WWnr    c                    SS K nUR                  R                  S5      (       aD  [        SS5       nUR	                  5       nS S S 5        SW;   d  SU;   a  U R
                  (       d   e [        R                  " [        R                  S[        R                  S9$ ! , (       d  f       N`= f! [         a  n[        S/UR                  Q76 eS nAff = f)	Nr   z/proc/cpuinforBCM2708BCM2709EGLr
   zUnable to load EGL library)ospathexistsopenreadr   r   r   r   r   r   r   ImportErrorargs)r   r6   finfoerrs        r   r5   EGLPlatform.EGLD   s     	77>>/**os+qvvx ,D I$5zz!z	G++''  ,+  	G:FSXXFF	Gs#   B*1B- 
B*-
C7CCc                 \    U R                   R                  n[        R                  Ul        U$ r   )r5   eglGetProcAddressr   c_void_prestype)r   rB   s     r   getExtensionProcedure!EGLPlatform.getExtensionProcedureX   s%     HH66$*OO!  r    c                      [         R                  " [        R                  S[        R                  S9$ ! [
         a     g f = f)Ngler
   r   r   s    r   GLEEGLPlatform.GLE]   r*   r   c                 \    U R                   R                  n[        R                  Ul        U$ r   )r5   eglGetCurrentContextr   rC   rD   )r   rL   s     r   GetCurrentContextEGLPlatform.GetCurrentContexti   s%    #xx<<'-$##r    c                    UR                  S5      SS  Vs/ s H  o"R                  5       PM     nnSSR                  U Vs/ s H  o"R                  5       PM     sn5      -   n[        R                  R                  U R                  U5      n[        R                  " [        R                  " U5      5      $ s  snf s  snf )a`  Platform specific function to retrieve a GLUT font pointer

GLUTAPI void *glutBitmap9By15;
#define GLUT_BITMAP_9_BY_15             (&glutBitmap9By15)

Key here is that we want the addressof the pointer in the DLL,
not the pointer in the DLL.  That is, our pointer is to the
pointer defined in the DLL, we don't want the *value* stored in
that pointer.
_   Nr,    )splittitlejoinr   rC   in_dllr-   	addressof)r   constantxr$   internalpointers         r   getGLUTFontPointerEGLPlatform.getGLUTFontPointero   s     %-NNC$9!"$=?$=q$=?BGG%>Aggi%>@@//(($))X?v//899 @%>s   B8B=
c                    > [         [        U ]  U5      nSSKnUR                  R                  S5      S:X  a/  UR                  R                  S5      (       d  SUR                  S'   U$ )z>Work around SDL not recognising wayland as platform by defaultr   NXDG_SESSION_TYPEwaylandSDL_VIDEODRIVER)superr   installr6   environget)r   	namespaceresultr6   	__class__s       r   rc   EGLPlatform.install   sU    {40;::>>,-:::>>"34409

,-r     )__name__
__module____qualname____firstlineno____doc__r   lazy_propertyr   r   r   r#   r(   r-   r"   r5   rE   rI   staticmethodr   	CFUNCTYPEDEFAULT_FUNCTION_TYPErM   r\   rc   __static_attributes____classcell__)rh   s   @r   r   r      s>   3         ,  ,       $  $G  G& !  !    )&*:*:<$  $
:  r    r   )ro   r   ctypes.utilOpenGL.platformr   r   BasePlatformr   rj   r    r   <module>ry      s"    +  6A<,, Ar    