Cleanup: gpu docs

This commit is contained in:
2018-11-20 07:32:49 +11:00
parent 5f21030a81
commit 3c8c976086
12 changed files with 130 additions and 86 deletions

View File

@@ -3,7 +3,8 @@ Rendering the 3D View into a Texture
------------------------------------
The scene has to have a camera for this example to work.
You could also make this independent of a specific camera, but Blender does not expose good functions to create view and projection matrices yet.
You could also make this independent of a specific camera,
but Blender does not expose good functions to create view and projection matrices yet.
"""
import bpy
import bgl
@@ -15,6 +16,7 @@ HEIGHT = 256
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
def draw():
context = bpy.context
scene = context.scene
@@ -35,4 +37,5 @@ def draw():
bgl.glDisable(bgl.GL_DEPTH_TEST)
draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')