From a1424dc87f2caea19d089c45b975f237e6746b22 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 28 Jul 2022 12:03:49 -0300 Subject: MeasureIt: replace deprecated bgl module Part of T80730 --- measureit/measureit_render.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'measureit/measureit_render.py') 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() -- cgit v1.2.3