a
    ij}C  ć                
   @   sę  d Z ddlmZmZmZ ddlmZmZ ddlZddlm	Z	m
Z
 ddlT ddlmZ dd	 Ze e” d
d”Ze e” d
d”Ze e” d
d”Ze e” d
d”Ze e” dd”Ze e” dd”Ze e” dd”Ze e” dd”Ze e” dd”Ze e”jddd dddZe e”jddd dddZe e”jddd dddZe e”jddd dddZe e”jddddjddd dddjddddjddddZe e”jddddjdd d dddjddddjddddZe e”jd!ddd d"d”Ze e ”jd
e
j!d#ddZ e e"”jd$e
j!d#ddZ"e e#”jd
e
j!d#ddZ#e e$”jd$e
j!d#ddZ$e e%”jd
e
j!d#ddZ%e e&”jd$e
j!d#ddZ&e e'”jd%d&d dddjddddZ'e e(”jd$e
j!d#ddZ(e e)”jd$e
j!d#ddZ)e e*”jd%d'd dddjddddZ*e e+”jd(dddjd)d*ddZ+e e,”jddddjd+d,d dddZ,e e-”jd$e
j!d#ddZ-e e.”jd$e
j!d#ddZ.e e/”jd$d-ddZ/e e0”jd$d-ddZ0e e1”jd.dddZ1e e2” d/d” d"d”Z2e e3” dd” d0d”Z3e e4” d1d”Z4e e5” d$d”Z5e e6” d$d”Z6e e7” d1d”Z7e e8” d2d”Z8e e9” d2d”Z9e e:” d2d”Z:e e;” d2d”Z;e e<” d2d”Z<e e=” d2d”Z=e e>” d2d”Z>e e?” d2d”Z?e e@” d2d”Z@e eA” d2d”ZAe eB” d2d”ZBe eC” d3d4”ZCe eD” d3d5”ZDe eE” d3d6”ZEe eF” d3d7”ZFdd8lmGZG dd9lHmIZJ dd:lKmLZL dd;lmMZM ejNd<ejOjPde	jQe	jRe SejT”ejUfd=d>ed?Z3eGjVd0d@ZWe e3” Xd!” Xd” Xd0eWjY” Zd0eWj[” \deW” \d!eWj]”Z3z[WW n& e^yL Z_ zW Y dZ_[_n
dZ_[_0 0 eJe*dAdB Z*eJe'dCdD Z'eJedEdF ZeJe,dGdH Z,eJedSdIdJZeJedTdKdLZeJe`dMdN Z`eJeadOdP ZaeJebdQdR ZbdS )Ua  OpenGL extension VERSION.GLES2_2_0

This module customises the behaviour of the 
OpenGL.raw.GLES2.VERSION.GLES2_2_0 to provide a more 
Python-friendly API

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GLES2_2_0.txt
é    )ŚplatformŚconstantŚarrays)Ś
extensionsŚwrapperN)Ś_typesŚ_glgets)Ś*)Ś_EXTENSION_NAMEc                  C   s   ddl m}  |  t”S )z=Return boolean indicating whether this extension is availabler   ©r   )ŚOpenGLr   ZhasGLExtensionr
   r   © r   ś\/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/OpenGL/GLES2/VERSION/GLES2_2_0.pyŚglInitGles220VERSION   s    r   ŚdataŚbuffersZframebuffersZrenderbuffersZtexturesŚindicesc                 C   s   | fS ©Nr   ©Śxr   r   r   Ś<lambda>;   ó    r   ŚnT)ŚsizeZpnameArgŚorPassInc                 C   s   | fS r   r   r   r   r   r   r   >   r   c                 C   s   | fS r   r   r   r   r   r   r   A   r   c                 C   s   | fS r   r   r   r   r   r   r   D   r   Ślength)é   )r   r   Śnamec                 C   s   | fS r   r   r   r   r   r   r   I   r   ŚbufSizer   Śtypec                 C   s   | fS r   r   r   r   r   r   r   R   r   ŚcountZshadersZpnameŚparamsZinfoLogc                 C   s   | fS r   r   r   r   r   r   r   r   r   c                 C   s   | fS r   r   r   r   r   r   r   }   r   Ś	precisionŚrange)é   Śsourcec                 C   s   | fS r   r   r   r   r   r   r      r   )é   ŚpointerŚbinaryŚstringZpixelsŚvalueŚvr   r$   é   r&   )Ś
converters)Ślazy)Ś_NULL_8_BYTE)ŚcontextdataŚglShaderSourcez@glShaderSource( GLhandle(shaderObj),[bytes(string),...]) -> None)Z	shaderObjr    r)   r   )ZdllZ
resultTypeZargTypesŚdocZargNamesŚ	extension)r   c                 C   sH   t  }t|t| |j}|dkrDt |”}| ||d| |j t”S dS )zjRetrieve the shader's error messages as a Python string

    returns string which is '' if no message
    r   NŚ )ŚGLsizeiŚglGetShaderivŚGL_INFO_LOG_LENGTHr*   ŚctypesŚcreate_string_bufferŚstripr/   ©ŚbaseOperationŚobjŚtargetr   Ślogr   r   r   ŚglGetShaderInfoLog*  s    
r@   c                 C   sH   t  }t|t| |j}|dkrDt |”}| ||d| |j t”S dS )zrRetrieve the shader program's error messages as a Python string

    returns string which is '' if no message
    r   Nr4   )r5   ŚglGetProgramivr7   r*   r8   r9   r:   r/   r;   r   r   r   ŚglGetProgramInfoLog:  s    
rB   c                 C   s>   t |t}|dkr2tj |f”}| ||d| |S tj d”S )z?Retrieve the attached objects as an array of GLhandle instancesr   N)r   )rA   ZGL_ATTACHED_SHADERSr   ZGLuintArrayZzeros)r<   r=   r   Zstorager   r   r   ŚglGetAttachedShadersJ  s    
rC   c                 C   s>   t t|t}|dkr:t |”}| ||d| |j t”S dS )zsRetrieve the program/shader's source code as a Python string

    returns string which is '' if no source code
    r   Nr4   )Śintr6   ZGL_SHADER_SOURCE_LENGTHr8   r9   r*   r:   r/   )r<   r=   r   r%   r   r   r   ŚglGetShaderSourceU  s    
rE   c           
      G   s¶   t t|t}|du r$t t|t}||k r|dkr| |||g|¢R  \}}}}	t|drj| ”  d”}n*t|dr| ”  d”}nt|dr|j}|||	fS t	d||d f dS )	ać  Retrieve the name, size and type of the uniform of the index in the program

    program -- specifies the program to be queried
    index -- index of the uniform to be queried

    Following parameters are optional:

    bufSize -- determines the size of the buffer (limits number of bytes written),
               if not provided, will be GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH
    length -- pointer-to-GLsizei that will hold the resulting length of the name
    size -- pointer-to-GLint that will hold the size of the attribute
    type -- pointer-to-GLenum that will hold the type constant of the attribute
    name -- pointer-to-GLchar that will hold the (null-terminated) name string

    returns (bytes) name, (int)size, (enum)type
    Nr   Śtobytesó    Śtostringr*   zIndex %s out of range 0 to %ir   )
rD   rA   ZGL_ACTIVE_UNIFORMSZGL_ACTIVE_UNIFORM_MAX_LENGTHŚhasattrrF   ŚrstriprH   r*   Ś
IndexError)
r<   ŚprogramŚindexr   ŚargsZ	max_indexr   r   r   r   r   r   r   ŚglGetActiveUniformc  s&    



ž’’rO   c                 G   s   |du rt t|t}|dkr(td|| |||g|¢R  dd \}}}t|drd| ”  d”}n*t|dr~| ”  d”}nt|dr|j}|||fS )	aČ  Retrieves information about the attribute variable.

    program -- specifies the program to be queried
    index -- index of the attribute to be queried

    Following parameters are optional:

    bufSize -- determines the size of the buffer (limits number of bytes written),
               if not provided, will be GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
    length -- pointer-to-GLsizei that will hold the resulting length of the name
    size -- pointer-to-GLint that will hold the size of the attribute
    type -- pointer-to-GLenum that will hold the type constant of the attribute
    name -- pointer-to-GLchar that will hold the (null-terminated) name string

    returns (bytes) name, (int)size, (enum)type
    Nr   z Active attribute length reportedr   rF   rG   rH   r*   )	rD   rA   ZGL_ACTIVE_ATTRIBUTE_MAX_LENGTHŚRuntimeErrorrI   rF   rJ   rH   r*   )r<   rL   rM   r   rN   r   r   r   r   r   r   ŚglGetActiveAttrib  s    
"


rQ   c                 C   s2   |st dt|}|d tkr(|t }| ||S ©z=Check that name is a string with a null byte at the end of itzNon-null name requiredé’’’’©Ś
ValueErrorZas_8_bitr/   ©r<   rL   r   r   r   r   ŚglGetUniformLocationŖ  s    rW   c                 C   s2   |st dt|}|d tkr(|t }| ||S rR   rT   rV   r   r   r   ŚglGetAttribLocationµ  s    rX   c           	   	   C   s<   t j ||”}d|f}t ||” | |||||t j |”S )aU  Set an attribute pointer for a given shader (index)

    index -- the index of the generic vertex to bind, see
        glGetAttribLocation for retrieval of the value,
        note that index is a global variable, not per-shader
    size -- number of basic elements per record, 1,2,3, or 4
    type -- enum constant for data-type
    normalized -- whether to perform int to float
        normalization on integer-type values
    stride -- stride in machine units (bytes) between
        consecutive records, normally used to create
        "interleaved" arrays
    pointer -- data-pointer which provides the data-values,
        normally a vertex-buffer-object or offset into the
        same.

    This implementation stores a copy of the data-pointer
    in the contextdata structure in order to prevent null-
    reference errors in the renderer.
    zvertex-attrib)r   ZArrayDatatypeZasArrayr0   ZsetValueZvoidDataPointer)	r<   rM   r   r   Ś
normalizedZstrider'   ŚarrayŚkeyr   r   r   ŚglVertexAttribPointerĮ  s    
śr\   )N)N)cŚ__doc__r   r   r   r   r   r   r8   ZOpenGL.raw.GLES2r   r   Z"OpenGL.raw.GLES2.VERSION.GLES2_2_0r
   r   ZglBufferDataZsetInputArraySizeZglBufferSubDataZglCompressedTexImage2DZglCompressedTexSubImage2DZglDeleteBuffersZglDeleteFramebuffersZglDeleteRenderbuffersZglDeleteTexturesZglDrawElementsZglGenBuffersZ	setOutputZglGenFramebuffersZglGenRenderbuffersZglGenTexturesrQ   rO   rC   ZglGetBooleanvZ_glget_size_mappingZglGetBufferParameterivZglGetFloatvZ%glGetFramebufferAttachmentParameterivZglGetIntegervrA   rB   ZglGetRenderbufferParameterivr6   r@   ZglGetShaderPrecisionFormatrE   ZglGetTexParameterfvZglGetTexParameterivZglGetVertexAttribfvZglGetVertexAttribivZglGetVertexAttribPointervZglShaderBinaryr1   ZglTexImage2DZglTexParameterfvZglTexParameterivZglTexSubImage2DZglUniform1fvZglUniform1ivZglUniform2fvZglUniform2ivZglUniform3fvZglUniform3ivZglUniform4fvZglUniform4ivZglUniformMatrix2fvZglUniformMatrix3fvZglUniformMatrix4fvZglVertexAttrib1fvZglVertexAttrib2fvZglVertexAttrib3fvZglVertexAttrib4fvr-   ZOpenGL.lazywrapperr.   Z_lazyZOpenGL._bytesr/   r0   ZcreateExtensionFunctionZPLATFORMZGLES2ZGLhandler5   ZPOINTERŚc_char_pZ
GLintArrayZStringLengthsŚconvZsetPyConverterZstringArrayZsetCResolverZstringArrayForCZsetCConverterZ
totalCountŚ	NameErrorŚerrrW   rX   r\   r   r   r   r   Ś<module>   sų  	
’
’
’
’
’
’
’
’
’
’
’
’
’
’żūł	
’żūł
’ż

’

’

’

’

’

’
’ż

’

’
’ż
’ż
’ż

’

’
’
’
’
’ż
’ż
’
’
’
’
’
’
’
’
’
’
’
’
’
’
’
’
’
’
’
üļ
žūł	öņī’




&


