
    _e:!                        d Z ddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lZg dZe
j*                  e
j,                  e
j.                  dZej2                  r1 ee
j4                        d        Z ee
j6                        d        Zne
j4                  Ze
j6                  Z ee
j8                        efd       Zd Z ee
j<                  ej>                        Z ee
j@                  ej                        Z 	 [d Z# e#e
jH                  ej>                        Z$ e#e
jJ                  ej                        Z%	 [#d Z&e
jN                  e
jP                  e
jR                  dZ*d Z+ ee
jX                        d        Z,d Z-d Z.e
j^                  e
j`                  dZ1d Z2 ee
jf                        d        Z3y
# e!$ r
Z"Y d
Z"["d
Z"["ww xY w# e!$ r
Z"Y d
Z"["d
Z"["ww xY w)z/Exceptional cases that need some extra wrapping    )arrays)GLfloatArray)lazy)GL_1_1)_errors)bytes)_configflags)NULLN)glBeginglCallListsglColorglDeleteTexturesglEndglMap1dglMap1fglMap2dglMap2f
glMaterialglRasterPosglTexParameterglVertexglAreTexturesResident)         c                 N    t         j                  j                           | |      S )zCBegin GL geometry-definition mode, disable automatic error checking)r   _error_checkeronBegin)baseFunctionmodes     7/usr/lib/python3/dist-packages/OpenGL/GL/exceptional.pyr   r   $   s!     	&&)T##    c                 L    t         j                  j                           |        S )zFFinish GL geometry-definition mode, re-enable automatic error checking)r   r   onEnd)r   s    r!   r   r   )   s     	$$'r"   c                     |t         u r?t        j                  j                  |      }t        j                  j	                  |      }n|} | ||      S )zDelete specified set of textures
    
    If array is *not* passed then `size` must be a `GLuintArray`
    compatible object which can be sized using `arraySize`, the 
    result of which will be used as size.
    )_NULLr   GLuintArrayasArray	arraySize)r   sizearrayptrs       r!   r   r   2   sI     ~  (($0!!++S2s$$r"   c                 F      fd} j                   |_          |_        |S )Nc                 |    j                  |      }j                  |      \  }}}	|	|z  }
 | |||
||||	||
      S )zglMap2(target, u1, u2, v1, v2, points[][][]) -> None

        This is a completely non-standard signature which doesn't allow for most
        of the funky uses with strides and the like, but it has been like this for
        a very long time...
        r(   
dimensions)targetu1u2v1v2pointsr,   uordervordervstrideustride	arrayTyper   s              r!   glMap2zglMap2.<locals>.glMap2C   s\     ) ) 4 4c ;vg&.VV
 	
r"   __name__r   )r   r;   r<   s   `` r!   r<   r<   B   s$    
$ #++FO&FMr"   c                 V      fd}|j                    j                   k(    |_        |S )Nc                 v    j                  |      }j                  |      }|d   }|d   } 	| |||||      S )zglMap1(target, u1, u2, points[][][]) -> None

        This is a completely non-standard signature which doesn't allow for most
        of the funky uses with strides and the like, but it has been like this for
        a very long time...
        r      r/   )
r1   r2   r3   r6   r,   dimsr7   r:   r;   r   s
           r!   glMap1zglMap1.<locals>.glMap1`   sL     )##S*aq'VR763@@r"   r=   )r   r;   rC   s   `` r!   rC   rC   _   s*    A OO|,,,&FMr"   c                  V    t        |       dk(  r| d   } t        t        |          } ||  S )z+Choose glRasterPosX based on number of argsrA   r   )lenglRasterPosDispatch)argsfunctions     r!   r   r   v   s/    
4yA~Aw"CI/Hdr"   c                  P    t        |       dk(  r| d   } t        t        |          |  S )z(Choose glVertexX based on number of argsrA   r   )rE   glVertexDispatch)rG   s    r!   r   r      s*    
4yA~AwSY(411r"   c           	         t        |      st        |t              rQ | t        |      t        j                  t        j                  t        j                  j                  |                  S t        j                  j                  |      }t        j                  j                  |      } | |t        j                  t        j                  t        j                  j                  |                  S  | |g| S )zglCallLists( bytes( lists ) or lists[] ) -> None

    Restricted version of glCallLists, takes a string or a GLuint compatible
    array data-type and passes into the base function.
    )rE   
isinstancer   fullGL_UNSIGNED_BYTEctypesc_void_pr   GLubyteArraydataPointerr'   r(   r)   GL_UNSIGNED_INT)r   listsrG   r,   r*   s        r!   r   r      s     t9ue%E
%% 3 3 ? ? HI 
   ((%1!!++S2  OOV//;;C@A
 	

 '''r"   c                    t        |t              rt        j                  | ||      S t        |t              rt        j
                  | ||      S t        j                  |t        j                        }t        j                  | ||      S )zLSet a texture parameter, choose underlying call based on pname and parameter)
rL   floatrM   glTexParameterfintglTexParameterir   r(   GL_FLOATglTexParameterfv)r1   pname	parametervalues       r!   r   r      sk    9e%##VUI??	Y	%##VUI??$$i@$$feU<<r"   c                     t        |      dk(  r?t        j                  |d         }|t        d|      t	        j
                  | ||      S t	        j                  | |g| S )zglMaterial -- convenience function to dispatch on argument type

    If passed a single argument in args, calls:
        glMaterialfv( faces, constant, args[0] )
    else calls:
        glMaterialf( faces, constant, *args )
    rA   r   zNull value in glMaterial: )rE   r   r(   
ValueErrorrM   glMaterialfvglMaterialf)facesconstantrG   args       r!   r   r      sc     4yA~""DG-;$HJJ  %3889499r"   )r   r   c                  h   t        |       }|dk(  rPt        j                  j                  | d         }t        t        j                  j                  |         } ||      S |dk(  rt        j                  |  S |dk(  rt        j                  |  S |dk(  rt        j                  |  S t        d|       )zglColor*f* -- convenience function to dispatch on argument type

    dispatches to glColor3f, glColor2f, glColor4f, glColor3f, glColor2f, glColor4f
    depending on the arguments passed...
    rA   r   r   r   r   z$Don't know how to handle arguments: )rE   r   r   r(   glColorDispatchr)   rM   	glColor2d	glColor3d	glColor4dr`   )rG   arglenre   rH   s       r!   r   r      s     YF{!!))474"6#6#6#@#@##GH	1~~&&	1~~&&	1~~&&NOOr"   c                 &   t        |      dk(  rd|d   }t        j                  j                  |      }t        j                  j	                  |      }t        j
                  j                  |f      }nt        |      dk(  rT	 t        |d         }|d   }t        j                  j                  |      }t        j
                  j                  |f      }n^t        |      dk(  rE|\  }}}t        j                  j                  |      }t        j
                  j                  |      }nt        d      t        j                  j                  |      }t        j
                  j                  |      } | |||      }|rt        t        |            D ]  }d||<   	 |S # t        $ rj |d   }t        j                  j                  |      }t        j                  j	                  |      }|d   }t        j
                  j                  |      }Y w xY w)an  Allow both Pythonic and C-style calls to glAreTexturesResident

        glAreTexturesResident( arrays.GLuintArray( textures) )

    or

        glAreTexturesResident( int(n), arrays.GLuintArray( textures), arrays.GLuboolean( output) )

    or

        glAreTexturesResident( int(n), arrays.GLuintArray( textures) )

    returns the output arrays.GLubooleanArray
    rA   r   r   r   z2Expected 1 to 3 arguments to glAreTexturesResident)rE   r   r'   r(   r)   GLbooleanArrayzerosrX   	TypeErrortypedPointerrange)	r   rG   texturesnoutput
texturePtr	outputPtrresultis	            r!   r   r      s     4yA~7%%--x9((2&&,,qd3	Ta	8T!WA AwH))118=H**001$7F	Ta (6%%--x9&&..8QSS##00(<J%%22F<I1j)5Fs6{# 	AF1I	M3  	=AwH))118=H"",,X6A!WF**22F<F	=s   F A0HH)4__doc__OpenGLr   OpenGL.arrays.arraydatatyper   OpenGL.lazywrapperr   _lazyOpenGL.GL.VERSIONr   rM   OpenGL.raw.GLr   OpenGL._bytesr   r	   OpenGL._nullr
   r&   rO   __all__glRasterPos2dglRasterPos3dglRasterPos4drF   ERROR_CHECKINGr   r   r   r<   r   GLdoubleArrayr   	NameErrorerrrC   r   r   r   
glVertex2d
glVertex3d
glVertex4drJ   r   r   r   r   
glColor3fv
glColor4fvrg   r   r    r"   r!   <module>r      s   5  4 , , !   & $   
DLL$ $ DJJ 
 llGJJE05 %  %, $,, 4 4
6
$,, 3 3
5	  $,, 4 4
6
$,, 3 3
5	  
2 ( (,=:" 
P, ""$1 %1w  		.  		s$   G	 G 	GGG*%G*