[Bf-blender-cvs] [54bed786a6] blender2.8: OpenGL: convert to new matrix API (part 2 of x)

Mike Erwin noreply at git.blender.org
Tue Mar 21 06:42:53 CET 2017


Commit: 54bed786a6304a1cb33980bcdf6ea8ccd73ff7e1
Author: Mike Erwin
Date:   Tue Mar 21 01:32:25 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB54bed786a6304a1cb33980bcdf6ea8ccd73ff7e1

OpenGL: convert to new matrix API (part 2 of x)

Part of T49450

For this batch I focused on usage of gpuMatrixUpdate_legacy.

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

M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_graph_draw.c
M	source/blender/editors/space_graph/graph_draw.c

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

diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 4117a15594..a76731da9d 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -583,7 +583,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 	/* pattern and search outline */
 	gpuPushMatrix();
 	gpuTranslate2fv(marker_pos);
-	gpuMatrixUpdate_legacy(); /* remove */
 
 	if (sc->flag & SC_SHOW_MARKER_PATTERN) {
 		immBegin(GL_LINE_LOOP, 4);
@@ -605,7 +604,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 	}
 
 	gpuPopMatrix();
-	gpuMatrixUpdate_legacy(); /* remove */
 }
 
 static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
@@ -712,7 +710,6 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 	/* pattern */
 	gpuPushMatrix();
 	gpuTranslate2fv(marker_pos);
-	gpuMatrixUpdate_legacy(); /* remove */
 
 	if (tiny) {
 		setlinestyle(3);
@@ -769,7 +766,6 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 	}
 
 	gpuPopMatrix();
-	gpuMatrixUpdate_legacy(); /* remove */
 }
 
 static float get_shortest_pattern_side(MovieTrackingMarker *marker)
@@ -846,7 +842,6 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 
 	gpuPushMatrix();
 	gpuTranslate2fv(marker_pos);
-	gpuMatrixUpdate_legacy(); /* remove */
 
 	dx = 6.0f / width / sc->zoom;
 	dy = 6.0f / height / sc->zoom;
@@ -906,7 +901,6 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 	}
 
 	gpuPopMatrix();
-	gpuMatrixUpdate_legacy(); /* remove */
 }
 
 static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 7afa2ae814..a9d02018f4 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -119,14 +119,13 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
 	if (sel == data->sel) {
 		immUniformThemeColor(sel ? TH_HANDLE_VERTEX_SELECT : TH_HANDLE_VERTEX);
 
-		glPushMatrix();
-		glTranslatef(scene_framenr, val, 0.0f);
-		glScalef(1.0f / data->xscale * data->hsize, 1.0f / data->yscale * data->hsize, 1.0f);
-		gpuMatrixUpdate_legacy();
+		gpuPushMatrix();
+		gpuTranslate2f(scene_framenr, val);
+		gpuScale2f(1.0f / data->xscale * data->hsize, 1.0f / data->yscale * data->hsize);
 
 		imm_draw_lined_circle(data->pos, 0, 0, 0.7, 8);
 
-		glPopMatrix();
+		gpuPopMatrix();
 	}
 }
 
@@ -153,9 +152,6 @@ static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc, unsigned int p
 	                                   (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,
 	                                   (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
 	                                   &userdata, tracking_segment_knot_cb, NULL, NULL);
-
-	gpuMatrixUpdate_legacy();
-
 	/* draw graph lines */
 	glEnable(GL_BLEND);
 	clip_graph_tracking_values_iterate(sc,
@@ -171,8 +167,6 @@ static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc, unsigned int p
 	                                   (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,
 	                                   (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
 	                                   &userdata, tracking_segment_knot_cb, NULL, NULL);
-
-	gpuMatrixUpdate_legacy();
 }
 
 typedef struct TrackErrorCurveUserData {
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index c8f692e45c..e382c2dbd2 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -405,9 +405,9 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
 static void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize, unsigned int pos)
 {
 	/* adjust view transform before starting */
-	glTranslatef(x, y, 0.0f);
-	glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
-	gpuMatrixUpdate_legacy();
+	gpuPushMatrix();
+	gpuTranslate2f(x, y);
+	gpuScale2f(1.0f / xscale * hsize, 1.0f / yscale * hsize);
 
 	/* draw X shape */
 	immBegin(GL_LINES, 4);
@@ -419,9 +419,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc
 	immEnd();
 
 	/* restore view transform */
-	glScalef(xscale / hsize, yscale / hsize, 1.0);
-	glTranslatef(-x, -y, 0.0f);
-	gpuMatrixUpdate_legacy();
+	gpuPopMatrix();
 }
 
 /* helper func - draw keyframe vertices only for an F-Curve */
@@ -570,11 +568,10 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
 	}
 
 	/* apply unit mapping */
-	glPushMatrix();
+	gpuPushMatrix();
 	unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
-	glScalef(1.0f, unit_scale, 1.0f);
-	glTranslatef(0.0f, offset, 0.0f);
-	gpuMatrixUpdate_legacy();
+	gpuScale2f(1.0f, unit_scale);
+	gpuTranslate2f(0.0f, offset);
 
 	immBegin(PRIM_LINE_STRIP, count);
 	
@@ -631,8 +628,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
 	
 	immEnd();
 
-	glPopMatrix();
-	gpuMatrixUpdate_legacy();
+	gpuPopMatrix();
 }
 
 /* helper func - check if the F-Curve only contains easily drawable segments 
@@ -666,11 +662,10 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 	short mapping_flag = ANIM_get_normalization_flags(ac);
 	
 	/* apply unit mapping */
-	glPushMatrix();
+	gpuPushMatrix();
 	unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
-	glScalef(1.0f, unit_scale, 1.0f);
-	glTranslatef(0.0f, offset, 0.0f);
-	gpuMatrixUpdate_legacy();
+	gpuScale2f(1.0f, unit_scale);
+	gpuTranslate2f(0.0f, offset);
 
 	/* For now, this assumes the worst case scenario, where all the keyframes have
 	 * bezier interpolation, and are drawn at full res.
@@ -815,8 +810,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 	
 	immEnd();
 
-	glPopMatrix();
-	gpuMatrixUpdate_legacy();
+	gpuPopMatrix();
 }
 
 /* Debugging -------------------------------- */
@@ -1096,9 +1090,9 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
 				float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
 				
 				/* apply unit-scaling to all values via OpenGL */
-				glPushMatrix();
-				glScalef(1.0f, unit_scale, 1.0f);
-				glTranslatef(0.0f, offset, 0.0f);
+				gpuPushMatrix();
+				gpuScale2f(1.0f, unit_scale);
+				gpuTranslate2f(0.0f, offset);
 				
 				/* set this once and for all - all handles and handle-verts should use the same thickness */
 				glLineWidth(1.0);
@@ -1120,7 +1114,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
 					draw_fcurve_samples(sipo, ar, fcu);
 				}
 				
-				glPopMatrix();
+				gpuPopMatrix();
 			}
 		}




More information about the Bf-blender-cvs mailing list