
    ^j
                    :   d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ ddZ G d d          Z e            Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej         Z dS )a  Information about version and extensions of current GL implementation.

Usage::

    from pyglet.gl import gl_info

    if gl_info.have_extension('GL_NV_register_combiners'):
        # ...

If you are using more than one context, you can set up a separate GLInfo
object for each context.  Call `set_active_context` after switching to the
context::

    from pyglet.gl.gl_info import GLInfo

    info = GLInfo()
    info.set_active_context()

    if info.have_version(4, 5):
        # ...

    )annotationsN)c_char_pcast)GL_EXTENSIONSGL_MAJOR_VERSIONGL_MINOR_VERSIONGL_RENDERER	GL_VENDOR
GL_VERSIONGLint)GLException)asstr	parameterintreturnc                P    ddl m} t                      } || |           |j        S )Nr   )glGetIntegerv)pyglet.gl.glr   r   value)r   r   numbers      L/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/gl/gl_info.py_get_numberr   !   s7    ******WWFM)V$$$<    c                       e Zd ZU dZded<   dZded<   dZded<   dZded	<   d
Zded<   d
Z	ded<   dZ
ded<   dZded<   dZd% fdZd%dZd%dZd&dZd'dZd(dZd)dZd*dZd+d,d!Zd*d"Zd*d#Zd*d$Z xZS )-GLInfoay  Information interface for a single GL context.

    A default instance is created automatically when the first OpenGL context
    is created.  You can use the module functions as a convenience for
    this default instance's methods.

    If you are using more than one context, you must call `set_active_context`
    when the context is active for this `GLInfo` instance.
    set[str]
extensions strvendorrendererz0.0versionr   r   major_versionminor_versiongl
opengl_apiFbool_have_contextr   Nonec                n    t                                                       t                      | _        d S N)super__init__setr   )self	__class__s    r   r-   zGLInfo.__init__=   s(    %%r   c                   d| _         | j        sqddlm}m}m t          t           |t                    t                    j
                  | _        t          t           |t                    t                    j
                  | _        t          t           |t                    t                    j
                  | _        d| j                                        v rdnd| _        	 t%          t&                    | _        t%          t*                    | _        t%          |          }fdt/          |          D             | _        t3          | j                  | _        n# t4          $ r Y nw xY wd| _        dS dS )	zStore information for the currently active context.

        This method is called automatically for the default context.
        Tr   )GL_NUM_EXTENSIONSglGetStringglGetStringiz	opengl esglesr%   c           	   3     K   | ]:}t          t           t          |          t                    j                  V  ;d S r+   )r   r   r   r   r   ).0ir4   s     r   	<genexpr>z,GLInfo.set_active_context.<locals>.<genexpr>W   sE      "w"wcd5ll=!.L.Lh)W)W)]#^#^"w"w"w"w"w"wr   N)r(   
_have_infor   r2   r3   r4   r   r   r
   r   r   r    r	   r!   r   r"   lowerr&   r   r   r#   r   r$   ranger   r.   r   )r/   r2   r3   num_extr4   s       @r   set_active_contextzGLInfo.set_active_contextA   sq   
 " 	#QQQQQQQQQQ[[%;%;X F F LMMDK!${{;'?'?"J"J"PQQDM kk*&=&=x!H!H!NOODL )4t|7I7I7K7K(K(KffQUDO%01A%B%B"%01A%B%B"%&788"w"w"w"whmnuhvhv"w"w"w"%do"6"6    #DOOO)	# 	#s   .A:E) )
E65E6c                "    d| _         d| _        d S )NF)r(   r:   r/   s    r   remove_active_contextzGLInfo.remove_active_context^   s    "r   c                    | j         S r+   )r(   r@   s    r   have_contextzGLInfo.have_contextb   s    !!r   	extensionc                J    | j         st          j        d           || j        v S )a  Determine if an OpenGL extension is available.

        Args:
            extension:
                The name of the extension to test for, including its ``GL_`` prefix.

        Returns:
            True if the extension is provided by the driver.
        No GL context created yet.r(   warningswarnr   )r/   rD   s     r   have_extensionzGLInfo.have_extensione   s-     ! 	8M6777DO++r   c                F    | j         st          j        d           | j        S )z)Get a set of available OpenGL extensions.rF   rG   r@   s    r   get_extensionszGLInfo.get_extensionss   s&    ! 	8M6777r   tuple[int, int]c                T    | j         st          j        d           | j        | j        fS )z2Get the current major and minor version of OpenGL.rF   r(   rH   rI   r#   r$   r@   s    r   get_versionzGLInfo.get_versiony   s/    ! 	8M6777!4#555r   c                F    | j         st          j        d           | j        S )z&Get the current OpenGL version string.rF   )r(   rH   rI   r"   r@   s    r   get_version_stringzGLInfo.get_version_string   s&    ! 	8M6777|r   majorminorc                    | j         st          j        d           | j        s	| j        sdS | j        |k    p+| j        |k    o
| j        |k    p| j        |k    o
| j        |k    S )a.  Determine if a version of OpenGL is supported.

        Args:
            major:
                The major revision number (typically 1 or 2).
            minor:
                The minor revision number.

        Returns:
            ``True`` if the requested or a later version is supported.
        rF   FrO   )r/   rS   rT   s      r   have_versionzGLInfo.have_version   s     ! 	8M6777! 	$*< 	5"U* N#u,L1Cu1LN#u,L1Cu1L	Or   c                F    | j         st          j        d           | j        S )z4Determine the renderer string of the OpenGL context.rF   )r(   rH   rI   r!   r@   s    r   get_rendererzGLInfo.get_renderer   s&    ! 	8M6777}r   c                F    | j         st          j        d           | j        S )z2Determine the vendor string of the OpenGL context.rF   )r(   rH   rI   r    r@   s    r   
get_vendorzGLInfo.get_vendor   s&    ! 	8M6777{r   c                F    | j         st          j        d           | j        S )zODetermine the OpenGL API version.

        Usually ``gl`` or ``gles``.
        rF   )r(   rH   rI   r&   r@   s    r   get_opengl_apizGLInfo.get_opengl_api   s(    
 ! 	8M6777r   )r   r)   )r   r'   )rD   r   r   r'   )r   r   )r   rM   )r   r   )r   )rS   r   rT   r   r   r'   )__name__
__module____qualname____doc____annotations__r    r!   r"   r#   r$   r&   r(   r:   r-   r>   rA   rC   rJ   rL   rP   rR   rV   rX   rZ   r\   __classcell__)r0   s   @r   r   r   (   s          FHGMMJMJ           # # # #:       " " " ", , , ,   6 6 6 6   O O O O O*             r   r   )r   r   r   r   )!r`   
__future__r   rH   ctypesr   r   r   r   r   r   r	   r
   r   r   pyglet.gl.libr   pyglet.utilr   r   r   _gl_inforL   rP   rR   rV   rX   rZ   r\   rJ   rC   rA   r>    r   r   <module>ri      sQ   , # " " " " "  ! ! ! ! ! ! ! ! u u u u u u u u u u u u u u u u u u % % % % % %         E E E E E E E ET 688("0 $$ 
(($ 6 0   r   