[Bf-blender-cvs] [4985838] blender2.8: OpenGL: use new uniform color functions

Mike Erwin noreply at git.blender.org
Sat Aug 27 20:14:25 CEST 2016


Commit: 498583844fb7d0adbbc91d512f98885800cdf46e
Author: Mike Erwin
Date:   Sat Aug 27 14:14:01 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB498583844fb7d0adbbc91d512f98885800cdf46e

OpenGL: use new uniform color functions

Color picker code motivated these convenience functions. looks much better now.

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

M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c22a310..f3c0b72 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2343,12 +2343,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
 
-	const float scale = 1.0f / 255.0f; /* TODO: treat as sRGB? */
-	const float outline_r = scale * (unsigned char)wcol->outline[0];
-	const float outline_g = scale * (unsigned char)wcol->outline[1];
-	const float outline_b = scale * (unsigned char)wcol->outline[2];
-
-	immUniform4f("color", outline_r, outline_g, outline_b, 1.0f);
+	immUniformColor3ubv(wcol->outline);
 	imm_draw_lined_circle(pos, centx, centy, radius, tot);
 
 	glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index bdc8bbc..2cf32ff 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -746,9 +746,9 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
 
 		immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
-		float crosshair_color[3];
-		UI_GetThemeColor3fv(TH_VIEW_OVERLAY, crosshair_color);
-		immUniform4f("color", crosshair_color[0], crosshair_color[1], crosshair_color[2], 1.0f);
+		unsigned char crosshair_color[3];
+		UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color);
+		immUniformColor3ubv(crosshair_color);
 
 		immBegin(GL_LINES, 8);
 		immVertex2f(pos, co[0] - f20, co[1]);




More information about the Bf-blender-cvs mailing list