Python bgl.Buffer() Examples

The following are 21 code examples of bgl.Buffer(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bgl , or try the search function .
Example #1
Source File: opengl_utils.py    From Blender-Addon-Photogrammetry-Importer with MIT License 6 votes vote down vote up
def copy_buffer_to_pixel(buffer, image):

    # According to 
    #   https://developer.blender.org/D2734
    #   https://docs.blender.org/api/current/gpu.html#copy-offscreen-rendering-result-back-to-ram
    # the buffer protocol is currently not implemented for 
    # bgl.Buffer and bpy.types.Image.pixels
    # (this makes the extraction very slow)
    
    # # from photogrammetry_importer.utils.stop_watch import StopWatch
    # Option 1 (faster)
    # sw = StopWatch()
    image.pixels = [v / 255 for v in buffer]
    # print('sw.get_elapsed_time()', sw.get_elapsed_time())

    # Option 2 (slower)
    # sw = StopWatch()
    # image.pixels = (np.asarray(buffer, dtype=np.uint8) / 255).tolist()
    # print('sw.get_elapsed_time()', sw.get_elapsed_time()) 
Example #2
Source File: bgl_ext.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def bgl_Buffer_reshape(buf, shape):
    assert np.prod(buf.dimensions) == np.prod(shape)

    c_buf = C_Buffer.from_address(id(buf))
    c_buf.ndimensions = len(shape)

    tmp_buf = bgl.Buffer(c_buf.type, (1,) * len(shape))
    c_tmp_buf = C_Buffer.from_address(id(tmp_buf))
    for i, v in enumerate(shape):
        c_tmp_buf.dimensions[i] = v

    offset = C_Buffer.dimensions.offset
    a = ctypes.pointer(ctypes.c_void_p.from_address(id(tmp_buf) + offset))
    b = ctypes.pointer(ctypes.c_void_p.from_address(id(buf) + offset))

    a[0], b[0] = b[0], a[0]

    del c_buf
    del c_tmp_buf
    del tmp_buf 
Example #3
Source File: ui.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, image_data, margin=0, async_load=True, width=None, height=None):
        super().__init__()
        self.defer_recalc = True
        self.image_data = image_data
        self.image_width,self.image_height = 16,16
        self.width = width or 16
        self.height = height or 16
        self.size_set = (width is not None) or (height is not None)
        self.loaded = False
        self.buffered = False
        self.deleted = False
        self.margin = margin

        self.texbuffer = bgl.Buffer(bgl.GL_INT, [1])
        bgl.glGenTextures(1, self.texbuffer)
        self.texture_id = self.texbuffer[0]

        if async_load: self.executor.submit(self.load_image)
        else: self.load_image()
        self.defer_recalc = False 
Example #4
Source File: bgl_ext.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def np_array_as_bgl_Buffer(array):
    type = array.dtype
    if   type == np.int8:    type = bgl.GL_BYTE
    elif type == np.int16:   type = bgl.GL_SHORT
    elif type == np.int32:   type = bgl.GL_INT
    elif type == np.float32: type = bgl.GL_FLOAT
    elif type == np.float64: type = bgl.GL_DOUBLE
    else: raise

    _decref = ctypes.pythonapi.Py_DecRef
    _incref = ctypes.pythonapi.Py_IncRef

    _decref.argtypes = _incref.argtypes = [ctypes.py_object]
    _decref.restype = _incref.restype = None

    buf = bgl.Buffer(bgl.GL_BYTE, (1, *array.shape))[0]
    c_buf = C_Buffer.from_address(id(buf))

    _decref(c_buf.parent)
    _incref(array)

    c_buf.parent = array # Prevents MEM_freeN
    c_buf.type = type
    c_buf.buf = array.ctypes.data
    return buf 
Example #5
Source File: shaders.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def shader_compile(name, shader):
        '''
        logging and error-checking not quite working :(
        '''

        bufLen = bgl.Buffer(bgl.GL_BYTE, 4)
        bufLog = bgl.Buffer(bgl.GL_BYTE, 2000)

        bgl.glCompileShader(shader)

        # XXX: this test is a hack to determine whether the shader was compiled successfully
        # TODO: rewrite to use a more correct test (glIsShader?)
        bgl.glGetShaderInfoLog(shader, 2000, bufLen, bufLog)
        log = ''.join(chr(v) for v in bufLog.to_list() if v)
        assert not log and 'was successfully compiled' not in log, 'ERROR WHILE COMPILING SHADER %s: %s' % (name,log)
        return log 
Example #6
Source File: bmesh_render.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, gltype):
        self.count = 0
        self.gltype = gltype
        self.gltype_name, self.gl_count, self.options_prefix = {
            bgl.GL_POINTS:   ('points',    1, 'point'),
            bgl.GL_LINES:    ('lines',     2, 'line'),
            bgl.GL_TRIANGLES: ('triangles', 3, 'poly'),
        }[self.gltype]

        # self.vao = bgl.Buffer(bgl.GL_INT, 1)
        # bgl.glGenVertexArrays(1, self.vao)
        # bgl.glBindVertexArray(self.vao[0])

        self.vbos = bgl.Buffer(bgl.GL_INT, 4)
        bgl.glGenBuffers(4, self.vbos)
        self.vbo_pos = self.vbos[0]
        self.vbo_norm = self.vbos[1]
        self.vbo_sel = self.vbos[2]
        self.vbo_idx = self.vbos[3]

        self.render_indices = False 
Example #7
Source File: shaders.py    From addon_common with GNU General Public License v3.0 6 votes vote down vote up
def enable(self):
        try:
            if DEBUG_PRINT:
                print('enabling shader <==================')
                if self.checkErrors:
                    self.drawing.glCheckError('something broke before enabling shader program (%s, %d)' % (self.name,self.shaderProg))
            bgl.glUseProgram(self.shaderProg)
            if self.checkErrors:
                self.drawing.glCheckError('something broke after enabling shader program (%s,%d)' % (self.name,self.shaderProg))

            # special uniforms
            # - uMVPMatrix works around deprecated gl_ModelViewProjectionMatrix
            if 'uMVPMatrix' in self.shaderVars:
                mvpmatrix = bpy.context.region_data.perspective_matrix
                mvpmatrix_buffer = bgl.Buffer(bgl.GL_FLOAT, [4,4], mvpmatrix)
                self.assign('uMVPMatrix', mvpmatrix_buffer)

            if self.funcStart: self.funcStart(self)
        except Exception as e:
            print('Error with using shader: ' + str(e))
            bgl.glUseProgram(0) 
Example #8
Source File: io_export_paper_model.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def display_islands(self, context):
    # TODO: save the vertex positions and don't recalculate them always?
    ob = context.active_object
    if not ob or ob.type != 'MESH':
        return
    mesh = ob.data
    if not mesh.paper_island_list or mesh.paper_island_index == -1:
        return

    bgl.glMatrixMode(bgl.GL_PROJECTION)
    perspMatrix = context.space_data.region_3d.perspective_matrix
    perspBuff = bgl.Buffer(bgl.GL_FLOAT, (4, 4), perspMatrix.transposed())
    bgl.glLoadMatrixf(perspBuff)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    objectBuff = bgl.Buffer(bgl.GL_FLOAT, (4, 4), ob.matrix_world.transposed())
    bgl.glLoadMatrixf(objectBuff)
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glBlendFunc(bgl.GL_SRC_ALPHA, bgl.GL_ONE_MINUS_SRC_ALPHA)
    bgl.glEnable(bgl.GL_POLYGON_OFFSET_FILL)
    bgl.glPolygonOffset(0, -10)  # offset in Zbuffer to remove flicker
    bgl.glPolygonMode(bgl.GL_FRONT_AND_BACK, bgl.GL_FILL)
    bgl.glColor4f(1.0, 0.4, 0.0, self.islands_alpha)
    island = mesh.paper_island_list[mesh.paper_island_index]
    for lface in island.faces:
        face = mesh.polygons[lface.id]
        bgl.glBegin(bgl.GL_POLYGON)
        for vertex_id in face.vertices:
            vertex = mesh.vertices[vertex_id]
            bgl.glVertex4f(*vertex.co.to_4d())
        bgl.glEnd()
    bgl.glPolygonOffset(0.0, 0.0)
    bgl.glDisable(bgl.GL_POLYGON_OFFSET_FILL)
    bgl.glLoadIdentity() 
Example #9
Source File: viewport.py    From BlendLuxCore with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, engine, context, scene):
        filmsize = utils.calc_filmsize(scene, context)
        self._width, self._height = filmsize
        self._border = utils.calc_blender_border(scene, context)
        self._offset_x, self._offset_y = self._calc_offset(context, scene, self._border)
        self._pixel_size = int(scene.luxcore.viewport.pixel_size)

        if utils.is_valid_camera(scene.camera) and not utils.in_material_shading_mode(context):
            pipeline = scene.camera.data.luxcore.imagepipeline
            self._transparent = pipeline.transparent_film
        else:
            self._transparent = False

        if self._transparent:
            bufferdepth = 4
            self._buffertype = bgl.GL_RGBA
            self._output_type = pyluxcore.FilmOutputType.RGBA_IMAGEPIPELINE
        else:
            bufferdepth = 3
            self._buffertype = bgl.GL_RGB
            self._output_type = pyluxcore.FilmOutputType.RGB_IMAGEPIPELINE

        self.buffer = bgl.Buffer(bgl.GL_FLOAT, [self._width * self._height * bufferdepth])
        self._init_opengl(engine, scene)

        # Denoiser
        self._noisy_file_path = self._make_denoiser_filepath("noisy")
        self._albedo_file_path = self._make_denoiser_filepath("albedo")
        self._normal_file_path = self._make_denoiser_filepath("normal")
        self._denoised_file_path = self._make_denoiser_filepath("denoised")
        current_dir = dirname(os.path.realpath(__file__))
        addon_dir = dirname(current_dir)  # Go up one level
        self._denoiser_path = which("oidnDenoise",
                                    path=os.path.join(addon_dir, "bin") + os.pathsep + os.environ["PATH"])
        self._denoiser_process = None
        self.denoiser_result_cached = False 
Example #10
Source File: bgl_ext.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def get_clip_planes(rv3d):
    #(int)(&((struct RegionView3D *)0)->rflag) == 842
    #(int)(&((struct RegionView3D *)0)->clip) == 464
    rv3d_ptr = rv3d.as_pointer()
    rflag = ctypes.c_short.from_address(rv3d_ptr + 842).value
    if rflag & 4: # RV3D_CLIPPING
        clip = (6 * (4 * ctypes.c_float)).from_address(rv3d_ptr + 464)
        return bgl.Buffer(bgl.GL_FLOAT, (6, 4), clip) 
Example #11
Source File: drawing.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def get_view_matrix_buffer(self):
        if not self.r3d: return None
        return bgl.Buffer(bgl.GL_FLOAT, [4,4], self.get_view_matrix_list()) 
Example #12
Source File: drawing.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def get_pixel_matrix_buffer(self):
        if not self.r3d: return None
        return bgl.Buffer(bgl.GL_FLOAT, [4,4], self.get_pixel_matrix_list()) 
Example #13
Source File: maths.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def to_bglMatrix(mat):
        # return bgl.Buffer(
        #     bgl.GL_FLOAT, len(mat)**2, [v for r in mat for v in r]
        # )
        return bgl.Buffer(bgl.GL_FLOAT, [len(mat), len(mat)], mat) 
Example #14
Source File: ui.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def buffer_image(self):
        if not self.loaded: return
        if self.buffered: return
        if self.deleted: return
        bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.texture_id)
        bgl.glTexEnvf(bgl.GL_TEXTURE_ENV, bgl.GL_TEXTURE_ENV_MODE, bgl.GL_MODULATE)
        bgl.glTexParameterf(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_NEAREST)
        bgl.glTexParameterf(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_LINEAR)
        # texbuffer = bgl.Buffer(bgl.GL_BYTE, [self.width,self.height,self.depth], image_data)
        image_size = self.image_width*self.image_height*self.image_depth
        texbuffer = bgl.Buffer(bgl.GL_BYTE, [image_size], self.image_flat)
        bgl.glTexImage2D(bgl.GL_TEXTURE_2D, 0, bgl.GL_RGBA, self.image_width, self.image_height, 0, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, texbuffer)
        del texbuffer
        bgl.glBindTexture(bgl.GL_TEXTURE_2D, 0)
        self.buffered = True 
Example #15
Source File: ui.py    From addon_common with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, margin=0, margin_left=None, margin_right=None, margin_top=None, margin_bottom=None, min_size=(0,0), max_size=None):
        self.is_dirty = True
        self.dirty_callbacks = []
        self.defer_recalc = False

        self.drawing = Drawing.get_instance()
        self.context = bpy.context
        self.last_dpi = self.drawing.get_dpi_mult()

        self._visible = None
        self._size = None
        self._width = 0
        self._height = 0
        self._margin_left = None
        self._margin_right = None
        self._margin_top = None
        self._margin_bottom = None
        self._min_size = None
        self._max_size = None

        self.pos = None
        self.size = None
        self.clip = None
        self.margin = margin
        if margin_left is not None: self.margin_left = margin_left
        if margin_right is not None: self.margin_right = margin_right
        if margin_top is not None: self.margin_top = margin_top
        if margin_bottom is not None: self.margin_bottom = margin_bottom
        self.min_size = min_size
        self.max_size = max_size
        self.visible = True
        self.scissor_buffer = bgl.Buffer(bgl.GL_INT, 4)
        self.scissor_enabled = None
        self.deleted = False 
Example #16
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def gl_matrix_to_buffer(m):
    tempMat = [m[i][j] for i in range(4) for j in range(4)]
    return bgl.Buffer(bgl.GL_FLOAT, 16, tempMat)


# ===== DRAWING CALLBACKS ===== # 
Example #17
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def gl_get(state_id):
    type, size = gl_state_info[state_id]
    buf = bgl.Buffer(type, [size])
    gl_type_getters[type](state_id, buf)
    return (buf if (len(buf) != 1) else buf[0]) 
Example #18
Source File: gl.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, context):
        rv3d = context.region_data
        persmat = rv3d.perspective_matrix
        flatten_persmat = [persmat[i][j] for i in range(4) for j in range(4)]
        self.persmat_buffer = bgl.Buffer(bgl.GL_FLOAT, 16, flatten_persmat)

        # GL_BLEND
        blend = bgl.Buffer(bgl.GL_BYTE, [1])
        bgl.glGetFloatv(bgl.GL_BLEND, blend)
        self.blend = blend[0]

        # GL_COLOR
        color = bgl.Buffer(bgl.GL_FLOAT, [4])
        bgl.glGetFloatv(bgl.GL_COLOR, color)
        self.color = color

        # GL_LINE_WIDTH
        line_width = bgl.Buffer(bgl.GL_FLOAT, [1])
        bgl.glGetFloatv(bgl.GL_LINE_WIDTH, line_width)
        self.line_width = line_width[0]

        # GL_Matrix_MODE
        matrix_mode = bgl.Buffer(bgl.GL_INT, [1])
        bgl.glGetIntegerv(bgl.GL_MATRIX_MODE, matrix_mode)
        self.matrix_mode = matrix_mode[0]

        # GL_PROJECTION_MATRIX
        projection_matrix = bgl.Buffer(bgl.GL_DOUBLE, [16])
        bgl.glGetFloatv(bgl.GL_PROJECTION_MATRIX, projection_matrix)
        self.projection_matrix = projection_matrix

        # blf: size, dpi
        self.size_dpi = (11, context.user_preferences.system.dpi) 
Example #19
Source File: shaders.py    From addon_common with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, name, srcVertex, srcFragment, funcStart=None, funcEnd=None, checkErrors=True, bindTo0=None):
        self.drawing = Drawing.get_instance()

        self.name = name
        self.shaderProg = bgl.glCreateProgram()
        self.shaderVert = bgl.glCreateShader(bgl.GL_VERTEX_SHADER)
        self.shaderFrag = bgl.glCreateShader(bgl.GL_FRAGMENT_SHADER)

        self.checkErrors = checkErrors

        srcVertex   = '\n'.join(l.strip() for l in srcVertex.split('\n'))
        srcFragment = '\n'.join(l.strip() for l in srcFragment.split('\n'))

        bgl.glShaderSource(self.shaderVert, srcVertex)
        bgl.glShaderSource(self.shaderFrag, srcFragment)

        dprint('RetopoFlow Shader Info: %s (%d)' % (self.name,self.shaderProg))
        logv = self.shader_compile(name, self.shaderVert)
        logf = self.shader_compile(name, self.shaderFrag)
        if len(logv.strip()):
            dprint('  vert log:\n' + '\n'.join(('    '+l) for l in logv.splitlines()))
        if len(logf.strip()):
            dprint('  frag log:\n' + '\n'.join(('    '+l) for l in logf.splitlines()))

        bgl.glAttachShader(self.shaderProg, self.shaderVert)
        bgl.glAttachShader(self.shaderProg, self.shaderFrag)

        if bindTo0:
            bgl.glBindAttribLocation(self.shaderProg, 0, bindTo0)

        bgl.glLinkProgram(self.shaderProg)

        self.shaderVars = {}
        lvars = [l for l in srcVertex.splitlines() if l.startswith('in ')]
        lvars += [l for l in srcVertex.splitlines() if l.startswith('attribute ')]
        lvars += [l for l in srcVertex.splitlines() if l.startswith('uniform ')]
        lvars += [l for l in srcFragment.splitlines() if l.startswith('uniform ')]
        for l in lvars:
            m = re.match('^(?P<qualifier>[^ ]+) +(?P<type>[^ ]+) +(?P<name>[^ ;]+)', l)
            assert m
            m = m.groupdict()
            q,t,n = m['qualifier'],m['type'],m['name']
            locate = bgl.glGetAttribLocation if q in {'in','attribute'} else bgl.glGetUniformLocation
            if n in self.shaderVars: continue
            self.shaderVars[n] = {
                'qualifier': q,
                'type': t,
                'location': locate(self.shaderProg, n),
                'reported': False,
                }

        dprint('  attribs: ' + ', '.join((k + ' (%d)'%self.shaderVars[k]['location']) for k in self.shaderVars if self.shaderVars[k]['qualifier'] in {'in','attribute'}))
        dprint('  uniforms: ' + ', '.join((k + ' (%d)'%self.shaderVars[k]['location']) for k in self.shaderVars if self.shaderVars[k]['qualifier'] in {'uniform'}))

        self.funcStart = funcStart
        self.funcEnd = funcEnd
        self.mvpmatrix_buffer = bgl.Buffer(bgl.GL_FLOAT, [4,4]) 
Example #20
Source File: opengl_utils.py    From Blender-Addon-Photogrammetry-Importer with MIT License 4 votes vote down vote up
def render_opengl_image(image_name, cam, point_size):
    draw_manager = DrawManager.get_singleton()
    coords, colors = draw_manager.get_coords_and_colors()

    scene = bpy.context.scene
    render = bpy.context.scene.render

    width = render.resolution_x
    height = render.resolution_y
    # TODO Provide an option to render from the 3D view perspective
    # width = bpy.context.region.width
    # height = bpy.context.region.height

    offscreen = gpu.types.GPUOffScreen(width, height)
    with offscreen.bind():

        bgl.glPointSize(point_size)
        #bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
        #bgl.glClear(bgl.GL_DEPTH_BUFFER_BIT)

        view_matrix = cam.matrix_world.inverted()
        projection_matrix = cam.calc_matrix_camera(
            bpy.context.evaluated_depsgraph_get(), 
            x=width,
            y=height)
        perspective_matrix = projection_matrix @ view_matrix

        gpu.matrix.load_matrix(perspective_matrix)
        gpu.matrix.load_projection_matrix(Matrix.Identity(4))
        
        shader = gpu.shader.from_builtin('3D_FLAT_COLOR')
        shader.bind()
        batch = batch_for_shader(shader, "POINTS", {"pos": coords, "color": colors})
        batch.draw(shader)
        
        buffer = bgl.Buffer(bgl.GL_BYTE, width * height * 4)
        bgl.glReadPixels(0, 0, width, height, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)

    offscreen.free()

    image = create_image_lazy(image_name, width, height)
    copy_buffer_to_pixel(buffer, image) 
Example #21
Source File: viewport.py    From BlendLuxCore with GNU General Public License v3.0 4 votes vote down vote up
def _init_opengl(self, engine, scene):
        # Create texture
        self.texture = bgl.Buffer(bgl.GL_INT, 1)
        bgl.glGenTextures(1, self.texture)
        self.texture_id = self.texture[0]

        # Bind shader that converts from scene linear to display space,
        # use the scene's color management settings.
        engine.bind_display_space_shader(scene)
        shader_program = bgl.Buffer(bgl.GL_INT, 1)
        bgl.glGetIntegerv(bgl.GL_CURRENT_PROGRAM, shader_program)

        # Generate vertex array
        self.vertex_array = bgl.Buffer(bgl.GL_INT, 1)
        bgl.glGenVertexArrays(1, self.vertex_array)
        bgl.glBindVertexArray(self.vertex_array[0])

        texturecoord_location = bgl.glGetAttribLocation(shader_program[0], "texCoord")
        position_location = bgl.glGetAttribLocation(shader_program[0], "pos")

        bgl.glEnableVertexAttribArray(texturecoord_location)
        bgl.glEnableVertexAttribArray(position_location)

        # Generate geometry buffers for drawing textured quad
        width = self._width * self._pixel_size
        height = self._height * self._pixel_size
        position = [
            self._offset_x, self._offset_y,
            self._offset_x + width, self._offset_y,
            self._offset_x + width, self._offset_y + height,
            self._offset_x, self._offset_y + height
        ]
        position = bgl.Buffer(bgl.GL_FLOAT, len(position), position)
        texcoord = [0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0]
        texcoord = bgl.Buffer(bgl.GL_FLOAT, len(texcoord), texcoord)

        self.vertex_buffer = bgl.Buffer(bgl.GL_INT, 2)

        bgl.glGenBuffers(2, self.vertex_buffer)
        bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[0])
        bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, position, bgl.GL_STATIC_DRAW)
        bgl.glVertexAttribPointer(position_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None)

        bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[1])
        bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, texcoord, bgl.GL_STATIC_DRAW)
        bgl.glVertexAttribPointer(texturecoord_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None)

        bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, NULL)
        bgl.glBindVertexArray(NULL)
        engine.unbind_display_space_shader()