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
This commit is contained in:
parent
f17e7e0b62
commit
36d9f7e375
Notes:
blender-bot
2023-02-14 08:47:25 +01:00
Referenced by issue #76541, OpenGl Depth Picking not selecting the front-most object
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue