
    3j                     ^   S r SrSSKr SSKrSSKJr  SSKJ	r	  SSK
Jr  SSKJrJr   " S	 S
\R                  5      r \R"                  " S/S5        SrS r\" S5      \R,                  \" S5      \R.                  \" S5      \R0                  \" \5      \R2                  \" \5      \R4                  \" S5      \R6                  \" S5      \R6                  \" S5      \R8                  \" S5      \R:                  SS0
r0 \R,                  \" S5      _\R.                  \" S5      _\R0                  \" S5      _\R8                  \" S5      _\R2                  \" \5      _\R:                  \" S5      _\R6                  \" S5      _\R4                  \" \5      _\	R>                  \" S5      _SS_S\" S5      _S\" S5      _S\" S5      _S\" S5      _S\" S5      _S\" S5      _S\" S5      _\" S5      \" S5      S.Er g! \ a  r\" S\-  5      eSrCff = f! \ a  rSrSr SrCGNSrCff = f)a  Buffer based Numpy plugin (not used)

This API is no more useful than the direct Numpy version, as Numpy already 
gives us the details we need *when using the accelerator module* at a low 
level, with very fast access.  When using the non-accelerated version the 
ctypes version *might* show some performance benefits, but it's not going 
to be fast no matter what we do without C-level code.
numpybuffers    NzNo numpy module present: %s)buffers)_types)GL_1_1)constanterrorc                   Z   ^  \ rS rSr\S 5       r\SU 4S jj5       r\SS j5       rSrU =r	$ )NumpyHandler   c                 >    [         R                  " U[        U   5      $ )z)Return Numpy array of zeros in given size)numpyzerosGL_TYPE_TO_ARRAY_MAPPING)clsdimstypeCodes      T/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/arrays/numpybuffers.pyr   NumpyHandler.zeros   s     {{D":8"DEE    c                 J   > [         [        U ]  U R                  X5      U5      $ )z7Convert given value to an array value of given typeCode)superr
   asArray
contiguous)r   valuer   	__class__s      r   r   NumpyHandler.asArray   s#     \#.u0NPXZZr   c                 h   [         U   n UR                  R                  nU(       a  Ub  X!R                  R                  :X  a  U$ U(       a?  U R
                  (       a.  SSKJn  UR                  " SUR                  R                  U5      eU R
                  (       a  SSKJn  UR                  " SU5      eUc  UR                  R                  n[        R                  " X5      $ ! [         aB  nU(       a  [        R                  " X5      s SnA$ [        R                  " U5      s SnA$ SnAff = f)a  Get contiguous array from source

source -- numpy Python array (or compatible object)
    for use as the data source.  If this is not a contiguous
    array of the given typeCode, a copy will be made,
    otherwise will just be returned unchanged.
typeCode -- optional 1-character typeCode specifier for
    the numpy.array function.

All gl*Pointer calls should use contiguous arrays, as non-
contiguous arrays will be re-copied on every rendering pass.
Although this doesn't raise an error, it does tend to slow
down rendering.
Nr   )r   z2Array of type %r passed, required array of type %rzNon-contiguous array passed)r   flagsr   dtypecharERROR_ON_COPYOpenGLr   	CopyErrorr   ascontiguousarrayAttributeError)r   sourcer   r   r   errs         r   r   NumpyHandler.contiguous   s      ,X7	C00J x/8\\=N=N3N!2!2(ooLLL%%x  $$,//9  #%||00H..BB9  	9..BB..88		9s)   C% %
D1/D,D1D,&D1,D1 )N)
__name__
__module____qualname____firstlineno__classmethodr   r   r   __static_attributes____classcell__)r   s   @r   r
   r
      sC    F F [ [ .C .Cr   r
      shHc                 @    [         R                  " SU S9R                  $ )N)r1   )r   )r   r   r   )r    s    r   lookupDtyper6   T   s    ;;D*000r   dfiBcbIP)r:   r2   )!__doc__REGISTRY_NAMEoperatorr   ImportErrorr'   OpenGL.arraysr   OpenGL.raw.GLr   OpenGL.raw.GL.VERSIONr   r"   r   r   BufferHandlerr
   array
SHORT_TYPE	TypeErrorUSHORT_TYPEr6   	GL_DOUBLEGL_FLOATGL_INTGL_SHORTGL_UNSIGNED_SHORTGL_UNSIGNED_BYTEGL_BYTEGL_UNSIGNED_INTARRAY_TO_GL_TYPE_MAPPING	GL_VOID_Pr   r)   r   r   <module>rU      s    @ "   ( "9CG)) 9Ct	KK!cJ
1 f&&foofmm
V__f66f--f--fnnf,,$ 
k#&
OOK$ MM;s# NNK$	
 OO[, K, [- k+6 k#& 	$ S	 S	 S	 S	 S	  S	!" S	#$ 
S		S	' o  @
8#>
??@F  JKs.   G> H >HHHH,H''H,