GPU: Replace glEnable/glDisable but GPU_state calls
This commit is contained in:
		@@ -1291,7 +1291,12 @@ static void ui_draw_colorband_handle_tri_hlight(uint pos, float x1, float y1, fl
 | 
			
		||||
 | 
			
		||||
static void ui_draw_colorband_handle_tri(uint pos, float x1, float y1, float halfwidth, float height, bool fill)
 | 
			
		||||
{
 | 
			
		||||
	glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH);
 | 
			
		||||
	if (fill) {
 | 
			
		||||
		GPU_polygon_smooth(true);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		GPU_line_smooth(true);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	immBegin(fill ? GPU_PRIM_TRIS : GPU_PRIM_LINE_LOOP, 3);
 | 
			
		||||
	immVertex2f(pos, x1 + halfwidth, y1);
 | 
			
		||||
@@ -1299,7 +1304,12 @@ static void ui_draw_colorband_handle_tri(uint pos, float x1, float y1, float hal
 | 
			
		||||
	immVertex2f(pos, x1 - halfwidth, y1);
 | 
			
		||||
	immEnd();
 | 
			
		||||
 | 
			
		||||
	glDisable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH);
 | 
			
		||||
	if (fill) {
 | 
			
		||||
		GPU_polygon_smooth(false);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		GPU_line_smooth(false);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ui_draw_colorband_handle_box(uint pos, float x1, float y1, float x2, float y2, bool fill)
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,7 @@
 | 
			
		||||
#include "GPU_glew.h"
 | 
			
		||||
#include "GPU_matrix.h"
 | 
			
		||||
#include "GPU_select.h"
 | 
			
		||||
#include "GPU_state.h"
 | 
			
		||||
 | 
			
		||||
#include "MEM_guardedalloc.h"
 | 
			
		||||
 | 
			
		||||
@@ -429,29 +430,29 @@ static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBas
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			if (is_depth) {
 | 
			
		||||
				glEnable(GL_DEPTH_TEST);
 | 
			
		||||
				GPU_depth_test(true);
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				glDisable(GL_DEPTH_TEST);
 | 
			
		||||
				GPU_depth_test(false);
 | 
			
		||||
			}
 | 
			
		||||
			is_depth_prev = is_depth;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* XXX force AntiAlias Gizmos. */
 | 
			
		||||
		glEnable(GL_LINE_SMOOTH);
 | 
			
		||||
		glEnable(GL_POLYGON_SMOOTH);
 | 
			
		||||
		GPU_line_smooth(true);
 | 
			
		||||
		GPU_polygon_smooth(true);
 | 
			
		||||
 | 
			
		||||
		gz->type->draw(C, gz);
 | 
			
		||||
 | 
			
		||||
		glDisable(GL_LINE_SMOOTH);
 | 
			
		||||
		glDisable(GL_POLYGON_SMOOTH);
 | 
			
		||||
		GPU_line_smooth(false);
 | 
			
		||||
		GPU_polygon_smooth(false);
 | 
			
		||||
 | 
			
		||||
		/* free/remove gizmo link after drawing */
 | 
			
		||||
		BLI_freelinkN(draw_gizmos, link);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (is_depth_prev) {
 | 
			
		||||
		glDisable(GL_DEPTH_TEST);
 | 
			
		||||
		GPU_depth_test(false);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -496,10 +497,10 @@ static void gizmo_draw_select_3D_loop(
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			if (is_depth) {
 | 
			
		||||
				glEnable(GL_DEPTH_TEST);
 | 
			
		||||
				GPU_depth_test(true);
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				glDisable(GL_DEPTH_TEST);
 | 
			
		||||
				GPU_depth_test(false);
 | 
			
		||||
			}
 | 
			
		||||
			is_depth_prev = is_depth;
 | 
			
		||||
		}
 | 
			
		||||
@@ -518,7 +519,7 @@ static void gizmo_draw_select_3D_loop(
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (is_depth_prev) {
 | 
			
		||||
		glDisable(GL_DEPTH_TEST);
 | 
			
		||||
		GPU_depth_test(false);
 | 
			
		||||
	}
 | 
			
		||||
	if (is_depth_skip_prev) {
 | 
			
		||||
		glDepthMask(true);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user