Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-10-26 04:13:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-26 04:13:03 +0300
commitca8fee62abc17fd514994c1c0bf34a3234be902a (patch)
tree001409ae1851477ab27eeab1893782774def9a4a /doc
parent065d19e223bd1a9ceec139ac32a4436c3cf3ec2e (diff)
Update gpu offscreen PyAPI example
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/gpu.types.GPUOffScreen.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/doc/python_api/examples/gpu.types.GPUOffScreen.py b/doc/python_api/examples/gpu.types.GPUOffScreen.py
index aa9514d11b2..ee0b6759f13 100644
--- a/doc/python_api/examples/gpu.types.GPUOffScreen.py
+++ b/doc/python_api/examples/gpu.types.GPUOffScreen.py
@@ -84,8 +84,8 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
try:
offscreen = gpu.types.GPUOffScreen(512, int(512 / aspect_ratio))
- except Exception as e:
- print(e)
+ except Exception as ex:
+ print(ex)
offscreen = None
return offscreen
@@ -145,7 +145,9 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture)
- shader.uniform_int(VIEW3D_OT_draw_offscreen.uniform_image, 0)
+ # # TODO, support passing ints
+ # shader.uniform_int(VIEW3D_OT_draw_offscreen.uniform_image, 0)
+ shader.uniform_int("image", 0)
batch_plane.draw()
# restoring settings
@@ -163,22 +165,23 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
format = gpu.types.GPUVertFormat()
pos_id = format.attr_add(
id="pos",
- comp_type="F32",
+ comp_type='F32',
len=2,
- fetch_mode="FLOAT")
-
+ fetch_mode='FLOAT',
+ )
uv_id = format.attr_add(
id="texCoord",
- comp_type="F32",
+ comp_type='F32',
len=2,
- fetch_mode="FLOAT")
-
+ fetch_mode='FLOAT',
+ )
vbo = gpu.types.GPUVertBuf(
len=len(g_plane_vertices),
- format=format)
+ format=format,
+ )
- vbo.fill(id=pos_id, data=g_plane_vertices["pos"])
- vbo.fill(id=uv_id, data=g_plane_vertices["uv"])
+ vbo.attr_fill(id=pos_id, data=g_plane_vertices["pos"])
+ vbo.attr_fill(id=uv_id, data=g_plane_vertices["uv"])
batch_plane = gpu.types.GPUBatch(type="TRIS", buf=vbo)
shader = self.global_shader