packages/pyglGA/scripts/basicIndexedTriangle.py
def init(self):
        """
        extra method for extra initialisation pf VertexArray
        Vertex array from attributes and optional index array. 
        Vertex Attributes should be list of arrays with one row per vertex. 
        """
        # create and bind(use) a vertex array object
        self._glid = gl.glGenVertexArrays(1)
        gl.glBindVertexArray(self._glid)
        nb_primitives, size = 0, 0
        
        # load buffer per vertex attribute (in a list with index = shader layout)
        for loc, data in enumerate(self._attributes):
            if data is not None:
                # bind a new VBO, upload it to GPU, declare size and type
                self._buffers.append(gl.glGenBuffers(1))
                data = np.array(data, np.float32, copy=False)
                nb_primitives, size = data.shape
                gl.glEnableVertexAttribArray(loc)
                gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self._buffers[-1])
                gl.glBufferData(gl.GL_ARRAY_BUFFER, data, self._usage)
                gl.glVertexAttribPointer(loc, size, gl.GL_FLOAT, False, 0, None)
                
        
        #optionally create and upload an index buffer for this VBO         
        self._draw_command = gl.glDrawArrays
        self._arguments = (0, nb_primitives)
        if self._index is not None:
            self._buffers += [gl.glGenBuffers(1)]
            index_buffer = np.array(self._index, np.int32, copy=False)
            gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, self._buffers[-1])
            gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, index_buffer, self._usage)
            self._draw_command = gl.glDrawElements
            self._arguments = (index_buffer.size, gl.GL_UNSIGNED_INT, None)

        # cleanup and unbind so no accidental subsequent state update
        gl.glBindVertexArray(0)
        gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)

        extra method for extra initialisation pf VertexArray
        Vertex array from attributes and optional index array. 
        Vertex Attributes should be list of arrays with one row per vertex. 
        
extra method for extra initialisation pf VertexArray
Vertex array from attributes and optional index array.
Vertex Attributes should be list of arrays with one row per vertex.
extra method for extra initialisation pf VertexArray Vertex array from attributes and optional index array . Vertex Attributes should be list of arrays with one row per vertex .
def init(self):
        self._glid = gl.glGenVertexArrays(1)
        gl.glBindVertexArray(self._glid)
        nb_primitives, size = 0, 0
        for loc, data in enumerate(self._attributes):
            if data is not None:
                self._buffers.append(gl.glGenBuffers(1))
                data = np.array(data, np.float32, copy=False)
                nb_primitives, size = data.shape
                gl.glEnableVertexAttribArray(loc)
                gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self._buffers[-1])
                gl.glBufferData(gl.GL_ARRAY_BUFFER, data, self._usage)
                gl.glVertexAttribPointer(loc, size, gl.GL_FLOAT, False, 0, None)
        self._draw_command = gl.glDrawArrays
        self._arguments = (0, nb_primitives)
        if self._index is not None:
            self._buffers += [gl.glGenBuffers(1)]
            index_buffer = np.array(self._index, np.int32, copy=False)
            gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, self._buffers[-1])
            gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, index_buffer, self._usage)
            self._draw_command = gl.glDrawElements
            self._arguments = (index_buffer.size, gl.GL_UNSIGNED_INT, None)
        gl.glBindVertexArray(0)
        gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
def init ( self ) : self . _glid = gl . glGenVertexArrays ( 1 ) gl . glBindVertexArray ( self . _glid ) nb_primitives , size = 0 , 0 for loc , data in enumerate ( self . _attributes ) : if data is not None : self . _buffers . append ( gl . glGenBuffers ( 1 ) ) data = np . array ( data , np . float32 , copy = False ) nb_primitives , size = data . shape gl . glEnableVertexAttribArray ( loc ) gl . glBindBuffer ( gl . GL_ARRAY_BUFFER , self . _buffers [ - 1 ] ) gl . glBufferData ( gl . GL_ARRAY_BUFFER , data , self . _usage ) gl . glVertexAttribPointer ( loc , size , gl . GL_FLOAT , False , 0 , None ) self . _draw_command = gl . glDrawArrays self . _arguments = ( 0 , nb_primitives ) if self . _index is not None : self . _buffers += [ gl . glGenBuffers ( 1 ) ] index_buffer = np . array ( self . _index , np . int32 , copy = False ) gl . glBindBuffer ( gl . GL_ELEMENT_ARRAY_BUFFER , self . _buffers [ - 1 ] ) gl . glBufferData ( gl . GL_ELEMENT_ARRAY_BUFFER , index_buffer , self . _usage ) self . _draw_command = gl . glDrawElements self . _arguments = ( index_buffer . size , gl . GL_UNSIGNED_INT , None ) gl . glBindVertexArray ( 0 ) gl . glBindBuffer ( gl . GL_ARRAY_BUFFER , 0 )
extra method for extra initialisation pf VertexArray
Vertex array from attributes and optional index array.
extra method for extra initialisation pf VertexArray Vertex array from attributes and optional index array .
"""
        extra method for extra initialisation pf VertexArray
        Vertex array from attributes and optional index array. 
        Vertex Attributes should be list of arrays with one row per vertex. 
        """ # create and bind(use) a vertex array object # load buffer per vertex attribute (in a list with index = shader layout) # bind a new VBO, upload it to GPU, declare size and type #optionally create and upload an index buffer for this VBO          # cleanup and unbind so no accidental subsequent state update
self