def setup_vertex_buffer(gl, data, shader, shader_variable):
    'Setup a vertex buffer with `data` vertices as `shader_variable` on shader'
    vbo = QOpenGLBuffer(QOpenGLBuffer.VertexBuffer)
    vbo.create()
    with bind(vbo):
        vertices = np.array(data, np.float32)
        (count, dim_vertex) = vertices.shape
        vbo.allocate(vertices.flatten(), vertices.nbytes)
        attr_loc = shader.attributeLocation(shader_variable)
        shader.enableAttributeArray(attr_loc)
        shader.setAttributeBuffer(attr_loc, gl.GL_FLOAT, 0, dim_vertex)
    return vbo
Setup a vertex buffer with `data` vertices as `shader_variable` on shader
def setup_vertex_buffer(gl, data, shader, shader_variable):
    
    vbo = QOpenGLBuffer(QOpenGLBuffer.VertexBuffer)
    vbo.create()
    with bind(vbo):
        vertices = np.array(data, np.float32)
        (count, dim_vertex) = vertices.shape
        vbo.allocate(vertices.flatten(), vertices.nbytes)
        attr_loc = shader.attributeLocation(shader_variable)
        shader.enableAttributeArray(attr_loc)
        shader.setAttributeBuffer(attr_loc, gl.GL_FLOAT, 0, dim_vertex)
    return vbo