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:
authorCampbell Barton <ideasman42@gmail.com>2018-02-27 12:16:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-27 12:16:53 +0300
commit4de50d757233009ccd5db8538fd036a62ce58648 (patch)
tree59e20b37c8b7ef8330cd783abdab4871c9599ef7 /source/blender/gpu/intern/gpu_select_pick.c
parent50b95211bf5263671cc577bd34fbf0ff04381aa8 (diff)
GPU_select: utility function to finalize selection
Needed for depth picking in 2.8
Diffstat (limited to 'source/blender/gpu/intern/gpu_select_pick.c')
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 0a77420fa25..d7a3ad07558 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -526,6 +526,19 @@ bool gpu_select_pick_load_id(unsigned int id)
return true;
}
+ /**
+ * (Optional), call before 'gpu_select_pick_end' if GL context is not kept.
+ * is not compatible with regular select case.
+ * */
+void gpu_select_pick_finalize(void)
+{
+ GPUPickState *ps = &g_pick_state;
+ if (ps->gl.is_init) {
+ /* force finishing last pass */
+ gpu_select_pick_load_id(ps->gl.prev_id);
+ }
+}
+
unsigned int gpu_select_pick_end(void)
{
GPUPickState *ps = &g_pick_state;
@@ -535,10 +548,7 @@ unsigned int gpu_select_pick_end(void)
#endif
if (ps->is_cached == false) {
- if (ps->gl.is_init) {
- /* force finishing last pass */
- gpu_select_pick_load_id(ps->gl.prev_id);
- }
+ gpu_select_pick_finalize();
glPopAttrib();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);