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
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-07-17 21:03:35 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-18 04:43:52 +0300
commitc14e6cdd5660be471e559206cd5eacee85fa0981 (patch)
tree42801e6f9379cad45e65f3f3c86f7957bc001c9a /source/blender/editors
parent1f2edba1fbf39a40b07bdf37276d2650655a4edd (diff)
Cleanup: View3D: Encapsulate OpenGL calls
Removes GL_DEPTH_RANGE query as it is not changed anywhere.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 82840f67699..c97be078b60 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2192,13 +2192,8 @@ static void view3d_opengl_read_Z_pixels(GPUViewport *viewport, rcti *rect, void
GPU_framebuffer_texture_attach(tmp_fb, dtxl->depth, 0, 0);
GPU_framebuffer_bind(tmp_fb);
- glReadPixels(rect->xmin,
- rect->ymin,
- BLI_rcti_size_x(rect),
- BLI_rcti_size_y(rect),
- GL_DEPTH_COMPONENT,
- GL_FLOAT,
- data);
+ GPU_framebuffer_read_depth(
+ tmp_fb, rect->xmin, rect->ymin, BLI_rcti_size_x(rect), BLI_rcti_size_y(rect), data);
GPU_framebuffer_restore();
GPU_framebuffer_free(tmp_fb);
@@ -2285,7 +2280,9 @@ void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect)
if (d->damaged) {
GPUViewport *viewport = WM_draw_region_get_viewport(region);
view3d_opengl_read_Z_pixels(viewport, rect, d->depths);
- glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
+ /* Range is assumed to be this as they are never changed. */
+ d->depth_range[0] = 0.0;
+ d->depth_range[1] = 1.0;
d->damaged = false;
}
}
@@ -2320,7 +2317,9 @@ void ED_view3d_depth_update(ARegion *region)
.ymax = d->h,
};
view3d_opengl_read_Z_pixels(viewport, &r, d->depths);
- glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
+ /* Assumed to be this as they are never changed. */
+ d->depth_range[0] = 0.0;
+ d->depth_range[1] = 1.0;
d->damaged = false;
}
}