Fix T68413: gpu module example in docs produces unexpected results

This commit is contained in:
Germano Cavalcante 2020-01-27 10:29:00 -03:00
parent 5c82c9bae4
commit 2ab5ca81a5
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Mesh with Random Vertex Colors
"""
import bpy
import gpu
import bgl
import numpy as np
from random import random
from gpu_extras.batch import batch_for_shader
@ -30,7 +31,9 @@ batch = batch_for_shader(
def draw():
bgl.glEnable(bgl.GL_DEPTH_TEST)
batch.draw(shader)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')