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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'measureit/measureit_render.py')
-rw-r--r--measureit/measureit_render.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/measureit/measureit_render.py b/measureit/measureit_render.py
index efc5c1b0..093149d5 100644
--- a/measureit/measureit_render.py
+++ b/measureit/measureit_render.py
@@ -8,7 +8,6 @@
# noinspection PyUnresolvedReferences
import bpy
import gpu
-import bgl
# noinspection PyUnresolvedReferences
import blf
from os import path, remove
@@ -54,8 +53,8 @@ def render_main(self, context, animation=False):
[0, 0, 0, 1]])
with offscreen.bind():
- bgl.glClearColor(0.0, 0.0, 0.0, 0.0)
- bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
+ fb = gpu.state.active_framebuffer_get()
+ fb.clear(color=(0.0, 0.0, 0.0, 0.0))
gpu.matrix.reset()
gpu.matrix.load_matrix(view_matrix)
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
@@ -101,9 +100,8 @@ def render_main(self, context, animation=False):
y2 = height - y1
draw_rectangle((x1, y1), (x2, y2), rfcolor)
- buffer = bgl.Buffer(bgl.GL_BYTE, width * height * 4)
- bgl.glReadBuffer(bgl.GL_COLOR_ATTACHMENT0)
- bgl.glReadPixels(0, 0, width, height, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)
+ buffer = fb.read_color(0, 0, width, height, 4, 0, 'UBYTE')
+ buffer.dimensions = width * height * 4
offscreen.free()