[Bf-blender-cvs] [f998c26a08e] temp-drawcontext: DRW: Fix selection & cursor autodist not working after rendering.

Clément Foucault noreply at git.blender.org
Thu Feb 22 15:01:31 CET 2018


Commit: f998c26a08e06df6c5907a9ba6190c5f2917f623
Author: Clément Foucault
Date:   Thu Feb 22 13:18:51 2018 +0100
Branches: temp-drawcontext
https://developer.blender.org/rBf998c26a08e06df6c5907a9ba6190c5f2917f623

DRW: Fix selection & cursor autodist not working after rendering.

That was caused by a wrong state initialization. We could remove every call to these if the state was not changed anywhere else (outside of DRW), but this is not the case...

===================================================================

M	source/blender/draw/intern/draw_manager.c

===================================================================

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 3056bf4c723..e7ce783cad7 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -3805,6 +3805,9 @@ void DRW_draw_select_loop(
 		}
 	}
 
+	gpuPushAttrib(GPU_ENABLE_BIT | GPU_VIEWPORT_BIT);
+	glDisable(GL_SCISSOR_TEST);
+
 	struct GPUViewport *viewport = GPU_viewport_create();
 	GPU_viewport_size_set(viewport, (const int[2]){BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)});
 
@@ -3887,6 +3890,10 @@ void DRW_draw_select_loop(
 	GPU_viewport_free(viewport);
 	MEM_freeN(viewport);
 
+	/* Restore Drawing area. */
+	gpuPopAttrib();
+	glEnable(GL_SCISSOR_TEST);
+
 	/* restore */
 	rv3d->viewport = backup_viewport;
 #endif  /* USE_GPU_SELECT */
@@ -3949,6 +3956,9 @@ void DRW_draw_depth_loop(
 	/* Reset before using it. */
 	memset(&DST, 0x0, sizeof(DST));
 
+	gpuPushAttrib(GPU_ENABLE_BIT | GPU_VIEWPORT_BIT);
+	glDisable(GL_SCISSOR_TEST);
+
 	struct GPUViewport *viewport = GPU_viewport_create();
 	GPU_viewport_size_set(viewport, (const int[2]){ar->winx, ar->winy});
 
@@ -4025,6 +4035,10 @@ void DRW_draw_depth_loop(
 	GPU_viewport_free(viewport);
 	MEM_freeN(viewport);
 
+	/* Restore Drawing area. */
+	gpuPopAttrib();
+	glEnable(GL_SCISSOR_TEST);
+
 	/* Changin context */
 	DRW_opengl_context_disable();



More information about the Bf-blender-cvs mailing list