[Bf-blender-cvs] [0fa887a] blender2.8: OpenGL: finish area action zone todo

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


Commit: 0fa887ae35d50e0941df47a01bac457c6109e65a
Author: Mike Erwin
Date:   Tue Dec 13 15:43:13 2016 -0500
Branches: blender2.8
https://developer.blender.org/rB0fa887ae35d50e0941df47a01bac457c6109e65a

OpenGL: finish area action zone todo

Replace outlined circle (24 vertices) with a point sprite (1 vertex).

Replace one todo with another todo.

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

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

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

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 63c152a..2aac9ce 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -58,6 +58,7 @@
 #include "ED_space_api.h"
 
 #include "GPU_immediate.h"
+#include "GPU_draw.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
@@ -299,25 +300,28 @@ static void region_draw_azone_icon(AZone *az)
 	VertexFormat* format = immVertexFormat();
 	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
 
-	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-
 	/* outlined circle */
+	GPU_enable_program_point_size(); /* TODO: make a fixed-size shader to avoid this */
+	immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_SMOOTH);
 	immUniform4f("color", 1.0f, 1.0f, 1.0f, 0.8f);
-	imm_draw_filled_circle(pos, midx, midy, 4.25f, 12);
-	/* TODO(merwin): replace this --^ with one round point once shader is ready */
-	glEnable(GL_LINE_SMOOTH);
-	immUniform4f("color", 0.2f, 0.2f, 0.2f, 0.9f);
-	imm_draw_lined_circle(pos, midx, midy, 4.25f, 12);
-	glDisable(GL_LINE_SMOOTH);
+	immUniform4f("outlineColor", 0.2f, 0.2f, 0.2f, 0.9f);
+	immUniform1f("outlineWidth", 1.0f);
+	immUniform1f("size", 9.5f);
+	immBegin(GL_POINTS, 1);
+	immVertex2f(pos, midx, midy);
+	immEnd();
+	immUnbindProgram();
+	GPU_disable_program_point_size();
 
 	/* + */
+	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+	immUniform4f("color", 0.2f, 0.2f, 0.2f, 0.9f);
 	immBegin(GL_LINES, 4);
 	immVertex2f(pos, midx, midy - 2);
 	immVertex2f(pos, midx, midy + 3);
 	immVertex2f(pos, midx - 2, midy);
 	immVertex2f(pos, midx + 3, midy);
 	immEnd();
-
 	immUnbindProgram();
 }




More information about the Bf-blender-cvs mailing list