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:
authorSebastian Parborg <darkdefende@gmail.com>2020-05-14 14:43:09 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-05-14 14:46:23 +0300
commit36d9f7e37540d211add476178972e1617c1533a2 (patch)
tree91efecabc968e1d8f184c1acc51e261818b6f43f /source/blender/gpu/intern/gpu_select_pick.c
parentf17e7e0b620743b030044ede522d0e4ae06c7bdf (diff)
Fix T76541: OpenGl Depth Picking not selecting frontmost object
The issue was that we used GL_ALWAYS for depth checking here which would lead to the depth information from objects being messed up. It would not represent which object was closest to the camera. Reviewed By: Clément Foucault, Jeroen Bakker, Campbell Barton Differential Revision: http://developer.blender.org/D7710
Diffstat (limited to 'source/blender/gpu/intern/gpu_select_pick.c')
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 674ca06d109..4b38cd333a1 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -314,17 +314,10 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
-
- if (mode == GPU_SELECT_PICK_ALL) {
- /* Note that other depth settings (such as #GL_LEQUAL) work too,
- * since the depth is always cleared.
- * Noting this for cases when depth picking is used where
- * drawing calls change depth settings. */
- glDepthFunc(GL_ALWAYS);
- }
- else {
- glDepthFunc(GL_LEQUAL);
- }
+ /* Always use #GL_LEQUAL even though GPU_SELECT_PICK_ALL always clears the buffer. This is
+ * because individual objects themselves might have sections that overlap and we need these
+ * to have the correct distance information. */
+ glDepthFunc(GL_LEQUAL);
float viewport[4];
glGetFloatv(GL_VIEWPORT, viewport);