diff options
author | Luca Rood <dev@lucarood.com> | 2017-02-23 19:35:16 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-23 22:12:08 +0300 |
commit | 2e83814e186f0d6746f0ce18123d6a5a67e07a64 (patch) | |
tree | 58d8d6703ee2ac85969511ce3d3f612ed4735dd4 /source/blender/editors/space_clip/clip_graph_draw.c | |
parent | ef60979029793c04dab2df051b965a86eeb299f6 (diff) |
OpenGl immediate mode: clip_draw.c and clip_graph_draw.c fixes
Fixed little typo in clip_draw.c and special case assert in
clip_graph_draw.c (track segments with single point).
Part of T49043
Diffstat (limited to 'source/blender/editors/space_clip/clip_graph_draw.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_draw.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index b373358b49c..7afa2ae8145 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -72,7 +72,7 @@ static void tracking_segment_point_cb(void *userdata, MovieTrackingTrack *UNUSED immVertex2f(data->pos, scene_framenr, val); } -static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { TrackMotionCurveUserData *data = (TrackMotionCurveUserData *) userdata; float col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -90,8 +90,13 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord)) @@ -220,7 +225,7 @@ static void tracking_error_segment_point_cb(void *userdata, } } -static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { if (coord == 1) { TrackErrorCurveUserData *data = (TrackErrorCurveUserData *) userdata; @@ -237,8 +242,13 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { /* This probably never happens here, but just in case... */ + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } } @@ -323,11 +333,12 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + if (clip) { + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + glPointSize(3.0f); - if (clip) { if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) { draw_tracks_motion_curves(v2d, sc, pos); } @@ -339,9 +350,9 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) if (sc->flag & SC_SHOW_GRAPH_FRAMES) { draw_frame_curves(sc, pos); } - } - immUnbindProgram(); + immUnbindProgram(); + } /* frame range */ clip_draw_sfra_efra(v2d, scene); |