Commit: 36d9f7e37540d211add476178972e1617c1533a2 Author: Sebastian Parborg Date: Thu May 14 13:43:09 2020 +0200 Branches: master https://developer.blender.org/rB36d9f7e37540d211add476178972e1617c1533a2
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 =================================================================== M source/blender/gpu/intern/gpu_select_pick.c =================================================================== 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); _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
