Copy functions from OpenGL.GL into _pyopengl namespace.
975090
def _inject():
    
    NS = _pyopengl2.__dict__
    for glname, ourname in _pyopengl2._functions_to_import:
        func = _get_function_from_pyopengl(glname)
        NS[ourname] = func
43831
def register(op_name):
        """"""
        def wrapper(func):
            """Helper function to map functions"""
            try:
                import onnx as _
                MXNetGraph.registry_[op_name] = func
            except ImportError:
                pass
            return func

        return wrapper
1272470
function(gl, vertices, uv) {
  var verticesBuf = createBuffer(gl, new Float32Array(vertices))
  var uvBuf = createBuffer(gl, new Float32Array(uv))

  var mesh = createVAO(gl, [
      { buffer: verticesBuf,
        size: 3
      },
      {
        buffer: uvBuf,
        size: 2
      }
      ])
  mesh.length = vertices.length/3

  return mesh
}
631396
def create(cls, opt_func:Union[type,Callable], lr:Union[float,Tuple,List], layer_groups:ModuleList, wd:Floats=0., 
               true_wd:bool=False, bn_wd:bool=True)->optim.Optimizer:
        ""
        split_params = split_no_wd_params(layer_groups)
        opt = opt_func([{'params': p, 'lr':0} for p in split_params])
        opt = cls(opt, wd=wd, true_wd=true_wd, bn_wd=bn_wd)
        opt.lr,opt.opt_func = listify(lr, layer_groups),opt_func
        return opt
830620
def from_module_dict(cls, environment, module_dict, globals):
        
        return cls._from_namespace(environment, module_dict, globals)
243691
def load_data(self, filename, ext):
        """"""
        from spyder_kernels.utils.iofuncs import iofunctions
        from spyder_kernels.utils.misc import fix_reference_name

        glbs = self._mglobals()

        load_func = iofunctions.load_funcs[ext]
        data, error_message = load_func(filename)

        if error_message:
            return error_message

        for key in list(data.keys()):
            new_key = fix_reference_name(key, blacklist=list(glbs.keys()))
            if new_key != key:
                data[new_key] = data.pop(key)

        try:
            glbs.update(data)
        except Exception as error:
            return str(error)

        return None
32960
function( gl ){
    this._set = 0;

    var enableBlend       = getP( gl, ~~GL_BLEND ),
        enableCullface    = getP( gl, ~~GL_CULL_FACE ),
        enableDepthTest   = getP( gl, ~~GL_DEPTH_TEST ),
        enableDither      = getP( gl, ~~GL_DITHER ),
        enablePolyOffset  = getP( gl, ~~GL_POLYGON_OFFSET_FILL ),
        // enableACoverage   = getP( gl, ~~GL_SAMPLE_ALPHA_TO_COVERAGE ),
        // enableCoverage    = getP( gl, ~~GL_SAMPLE_COVERAGE ),
        enableScissor     = getP( gl, ~~GL_SCISSOR_TEST ),
        enableStencil     = getP( gl, ~~GL_STENCIL_TEST ),

        blendSrcRGB       = getP( gl, ~~GL_BLEND_SRC_RGB ),
        blendDstRGB       = getP( gl, ~~GL_BLEND_DST_RGB ),
        blendSrcAlpha     = getP( gl, ~~GL_BLEND_SRC_ALPHA ),
        blendDstAlpha     = getP( gl, ~~GL_BLEND_DST_ALPHA ),
        blendEqRgb        = getP( gl, ~~GL_BLEND_EQUATION_RGB ),
        blendEqAlpha      = getP( gl, ~~GL_BLEND_EQUATION_ALPHA ),
        stencilFunc       = getP( gl, ~~GL_STENCIL_FUNC ),
        stencilRef        = getP( gl, ~~GL_STENCIL_REF ),
        stencilValueMask  = getP( gl, ~~GL_STENCIL_VALUE_MASK ),
        stencilWriteMask  = getP( gl, ~~GL_STENCIL_WRITEMASK ),
        stencilOpFail     = getP( gl, ~~GL_STENCIL_FAIL ),
        stencilOpZfail    = getP( gl, ~~GL_STENCIL_PASS_DEPTH_FAIL ),
        stencilOpZpass    = getP( gl, ~~GL_STENCIL_PASS_DEPTH_PASS ),
        stencilBFunc      = getP( gl, ~~GL_STENCIL_BACK_FUNC ),
        stencilBRef       = getP( gl, ~~GL_STENCIL_BACK_REF ),
        stencilBValueMask = getP( gl, ~~GL_STENCIL_BACK_VALUE_MASK ),
        stencilBWriteMask = getP( gl, ~~GL_STENCIL_BACK_WRITEMASK ),
        stencilBOpFail    = getP( gl, ~~GL_STENCIL_BACK_FAIL ),
        stencilBOpZfail   = getP( gl, ~~GL_STENCIL_BACK_PASS_DEPTH_FAIL ),
        stencilBOpZpass   = getP( gl, ~~GL_STENCIL_BACK_PASS_DEPTH_PASS ),

        polyOffsetFactor  = getP( gl, ~~GL_POLYGON_OFFSET_FACTOR ),
        polyOffsetUnits   = getP( gl, ~~GL_POLYGON_OFFSET_UNITS ),
        scissorBox        = getP( gl, ~~GL_SCISSOR_BOX ),
        colorMaskArray    = getP( gl, ~~GL_COLOR_WRITEMASK ),
        depthWriteMask    = getP( gl, ~~GL_DEPTH_WRITEMASK ),
        blendColor        = getP( gl, ~~GL_BLEND_COLOR ),
        viewport          = getP( gl, ~~GL_VIEWPORT ),
        depthRange        = getP( gl, ~~GL_DEPTH_RANGE ),
        lineWidth         = getP( gl, ~~GL_LINE_WIDTH );




    this.enableBlend( enableBlend );

    if( blendSrcRGB !== blendSrcAlpha || blendDstRGB !== blendDstAlpha ) {
      this.blendFuncSeparate(
        blendSrcRGB,
        blendDstRGB,
        blendSrcAlpha,
        blendDstAlpha
      );
    } else {
      this.blendFunc(
        blendSrcRGB,
        blendDstRGB
      );
    }

    if( blendEqRgb !== blendEqAlpha ) {
      this.blendEquationSeparate(
        blendEqRgb,
        blendEqAlpha
      );
    } else {
      this.blendEquation(
        blendEqRgb
      );
    }



    this.enableStencil( enableStencil );
    if( stencilFunc      !== stencilBFunc     ||
        stencilRef       !== stencilBRef      ||
        stencilValueMask !== stencilBValueMask ) {
      this.stencilFuncSeparate(
        stencilFunc,
        stencilRef,
        stencilValueMask,
        stencilBFunc,
        stencilBRef,
        stencilBValueMask
      );
    } else {
      this.stencilFunc(
        stencilFunc,
        stencilRef,
        stencilValueMask
      );

    }

    if( stencilOpFail  !== stencilBOpFail   ||
        stencilOpZfail !== stencilBOpZfail  ||
        stencilOpZpass !== stencilBOpZpass ) {
      this.stencilOpSeparate(
        stencilOpFail,
        stencilOpZfail,
        stencilOpZpass,
        stencilBOpFail,
        stencilBOpZfail,
        stencilBOpZpass
      );
    } else {
      this.stencilOp(
        stencilOpFail,
        stencilOpZfail,
        stencilOpZpass
      );
    }

    if( stencilWriteMask !== stencilBWriteMask ){
      this.stencilMaskSeparate( stencilWriteMask, stencilBWriteMask );
    } else {
      this.stencilMask( stencilWriteMask );
    }


    // DEPTH
    // -----

    this.depthFunc(
      gl.getParameter( ~~GL_DEPTH_FUNC )
    );

    this.enableDepthTest( enableDepthTest );

    // FACE CULLING
    // ------------
    this.cullFace(
      gl.getParameter( ~~GL_CULL_FACE_MODE )
    );

    this.enableCullface( enableCullface );

    this.frontFace(
      gl.getParameter( ~~GL_FRONT_FACE )
    );


    // POLYGON_OFFSET

    this.enablePolygonOffset( enablePolyOffset  );

    this.polygonOffset( polyOffsetFactor, polyOffsetUnits );

    // SCISSOR

    this.enableScissor   ( enableScissor     );
    this.scissor(
      scissorBox[0],
      scissorBox[1],
      scissorBox[2],
      scissorBox[3]
    );
    // DITHER
    // ------

    this.enableDither    ( enableDither      );

    this.colorMask( colorMaskArray[0], colorMaskArray[1], colorMaskArray[2], colorMaskArray[3] );

    this.depthMask( depthWriteMask );
    //this.enableACoverage ( enableACoverage   );
    //this.enableCoverage  ( enableCoverage    );

    this.blendColor(
      blendColor[0],
      blendColor[1],
      blendColor[2],
      blendColor[3]
    );

    this.viewport(
      viewport[0],
      viewport[1],
      viewport[2],
      viewport[3]
    );

    this.depthRange(
      depthRange[0],
      depthRange[1]
    );

    this.lineWidth( lineWidth );

  }
168052
def import_functions(names, src, dst):
    """"""
    for name in names:
        module = importlib.import_module('pygsp.' + src)
        setattr(sys.modules['pygsp.' + dst], name, getattr(module, name))
1027207
def _process_glsl_template(template, colors):
    """"""
    for i in range(len(colors) - 1, -1, -1):
        color = colors[i]
        assert len(color) == 4
        vec4_color = 'vec4(%.3f, %.3f, %.3f, %.3f)' % tuple(color)
        template = template.replace('$color_%d' % i, vec4_color)
    return template
203528
def getMirrorTextureGL(self, eEye):
        """"""

        fn = self.function_table.getMirrorTextureGL
        pglTextureId = glUInt_t()
        pglSharedTextureHandle = glSharedTextureHandle_t()
        result = fn(eEye, byref(pglTextureId), byref(pglSharedTextureHandle))
        return result, pglTextureId, pglSharedTextureHandle
1077471
def _rename_objects_pretty(self):
        
        #
        # 1. For each object, add its static names to the global namespace
        #    and make a list of the shaders used by the object.
        #

        # {name: obj} mapping for finding unique names
        # initialize with reserved keywords.
        self._global_ns = dict([(kwd, None) for kwd in gloo.util.KEYWORDS])
        # functions are local per-shader
        self._shader_ns = dict([(shader, {}) for shader in self.shaders])

        # for each object, keep a list of shaders the object appears in
        obj_shaders = {}

        for shader_name, deps in self._shader_deps.items():
            for dep in deps:
                # Add static names to namespace
                for name in dep.static_names():
                    self._global_ns[name] = None

                obj_shaders.setdefault(dep, []).append(shader_name)

        #
        # 2. Assign new object names
        #
        name_index = {}
        for obj, shaders in obj_shaders.items():
            name = obj.name
            if self._name_available(obj, name, shaders):
                # hooray, we get to keep this name
                self._assign_name(obj, name, shaders)
            else:
                # boo, find a new name
                while True:
                    index = name_index.get(name, 0) + 1
                    name_index[name] = index
                    ext = '_%d' % index
                    new_name = name[:32-len(ext)] + ext
                    if self._name_available(obj, new_name, shaders):
                        self._assign_name(obj, new_name, shaders)
                        break
140737
def python(self, func, *args, **kwargs):
        """"""
        self.ops.append(lambda: func(*args, **kwargs))
542615
def copy_func(f, name=None, sinceversion=None, doc=None):
    
    # See
    # http://stackoverflow.com/questions/6527633/how-can-i-make-a-deepcopy-of-a-function-in-python
    fn = types.FunctionType(f.__code__, f.__globals__, name or f.__name__, f.__defaults__,
                            f.__closure__)
    # in case f was given attrs (note this dict is a shallow copy):
    fn.__dict__.update(f.__dict__)
    if doc is not None:
        fn.__doc__ = doc
    if sinceversion is not None:
        fn = since(sinceversion)(fn)
    return fn
668105
def _import(func):
        """"""
        func_name = func.__name__

        # from foo.bar import func // func()
        # WARNING: May be broken in IPython, in which case the widget will use a fallback
        if func_name in globals():
            return func_name

        # import foo.bar // foo.bar.func()
        module_name = func.__module__
        submodules = module_name.split('.')

        if submodules[0] in globals():
            return module_name + '.' + func_name

        # from foo import bar // bar.func()
        for i in range(len(submodules)):
            m = submodules[i]
            if m in globals():
                return '.'.join(submodules[i:]) + '.' + func_name

        # import foo.bar as fb // fb.func()
        module_ref = sys.modules[func.__module__]
        all_globals = globals()

        for n in all_globals:
            if all_globals[n] == module_ref:
                return n + '.' + func_name

        # Not Found, return function name
        return func_name
1235062
def _load_shader(filename):
    """"""
    curdir = op.dirname(op.realpath(__file__))
    glsl_path = op.join(curdir, 'glsl')
    path = op.join(glsl_path, filename)
    with open(path, 'r') as f:
        return f.read()
453117
def copy(self):
        '''
        '''
        return Namespace(self.dictionary.copy(), self._macros, self._blocks)
215630
function ShaderAttribute(gl, program, location, dimension, name, constFunc, relink) {
  this._gl = gl
  this._program = program
  this._location = location
  this._dimension = dimension
  this._name = name
  this._constFunc = constFunc
  this._relink = relink
}