[Bf-blender-cvs] [1bfe359] blender2.8: OpenGL fixes

Mike Erwin noreply at git.blender.org
Wed Dec 14 08:44:45 CET 2016


Commit: 1bfe359802a105f5075e9e17c29cd832add619fd
Author: Mike Erwin
Date:   Wed Dec 14 02:43:26 2016 -0500
Branches: blender2.8
https://developer.blender.org/rB1bfe359802a105f5075e9e17c29cd832add619fd

OpenGL fixes

- mixing of old & new APIs
- vertex format mismatch

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

M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 53307c6..f17c61b 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -492,26 +492,23 @@ void UI_draw_safe_areas(
 	const float size_y_half = (y2 - y1) * 0.5f;
 
 	const float *safe_areas[] = {title_aspect, action_aspect};
-	int safe_len = ARRAY_SIZE(safe_areas);
+	const int safe_len = ARRAY_SIZE(safe_areas);
 	bool is_first = true;
 
 	for (int i = 0; i < safe_len; i++) {
 		if (safe_areas[i][0] || safe_areas[i][1]) {
-			float margin_x, margin_y;
-			float minx, miny, maxx, maxy;
-
 			if (is_first) {
-				UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25f, 0);
+				immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f);
 				is_first = false;
 			}
 
-			margin_x = safe_areas[i][0] * size_x_half;
-			margin_y = safe_areas[i][1] * size_y_half;
+			float margin_x = safe_areas[i][0] * size_x_half;
+			float margin_y = safe_areas[i][1] * size_y_half;
 
-			minx = x1 + margin_x;
-			miny = y1 + margin_y;
-			maxx = x2 - margin_x;
-			maxy = y2 - margin_y;
+			float minx = x1 + margin_x;
+			float miny = y1 + margin_y;
+			float maxx = x2 - margin_x;
+			float maxy = y2 - margin_y;
 
 			imm_draw_line_box(pos, minx, miny, maxx, maxy);
 		}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2aac9ce..19224ed 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -333,13 +333,16 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2)
 	VertexFormat* format = immVertexFormat();
 	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
 
+	glEnable(GL_BLEND);
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+	immUniformColor4f(0.8f, 0.8f, 0.8f, 0.4f);
 
 	immRectf(pos, (x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad);
 	immRectf(pos, x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f);
 	immRectf(pos, (x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f);
 
 	immUnbindProgram();
+	glDisable(GL_BLEND);
 }
 
 static void region_draw_azone_tab_plus(AZone *az)
@@ -365,12 +368,7 @@ static void region_draw_azone_tab_plus(AZone *az)
 	float color[4] = {0.05f, 0.05f, 0.05f, 0.4f};
 	UI_draw_roundbox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color);
 
-	glEnable(GL_BLEND);
-
-	glColor4f(0.8f, 0.8f, 0.8f, 0.4f);
 	draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2);
-
-	glDisable(GL_BLEND);
 }
 
 static void region_draw_azone_tab(AZone *az)
@@ -2155,7 +2153,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, float fill_color[4], con
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	VertexFormat* format = immVertexFormat();
-	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+	unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT);
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 	immUniformColor4fv(fill_color);
 	immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);




More information about the Bf-blender-cvs mailing list