Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c9
-rw-r--r--source/blender/editors/space_clip/clip_draw.c51
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c15
-rw-r--r--source/blender/editors/space_clip/clip_utils.c9
-rw-r--r--source/blender/editors/space_clip/space_clip.c9
5 files changed, 49 insertions, 44 deletions
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index bc2aa3ae67f..d50d10d5cc3 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -54,6 +54,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "clip_intern.h" /* own include */
@@ -147,7 +148,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
strip[3] = 0.5f;
selected_strip[3] = 1.0f;
- glEnable(GL_BLEND);
+ GPU_blend(true);
clip_draw_dopesheet_background(ar, clip, pos_id);
@@ -279,7 +280,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
immUnbindProgram();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -378,7 +379,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
PropertyRNA *chan_prop_lock = RNA_struct_type_find_property(&RNA_MovieTrackingTrack, "lock");
BLI_assert(chan_prop_lock);
- glEnable(GL_BLEND);
+ GPU_blend(true);
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
float yminc = (float)(y - CHANNEL_HEIGHT_HALF);
float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF);
@@ -403,7 +404,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
/* adjust y-position for next one */
y -= CHANNEL_STEP;
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
UI_block_end(C, block);
UI_block_draw(C, block);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 5962bfe33f3..d91e039ecb6 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -60,6 +60,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_types.h"
@@ -156,8 +157,8 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(&clip->tracking);
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* cache background */
ED_region_cache_draw_background(ar);
@@ -235,7 +236,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
}
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* current frame */
x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
@@ -313,8 +314,8 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
imm_draw_box_checker_2d(x, y, x + zoomx * ibuf->x, y + zoomy * ibuf->y);
}
@@ -335,7 +336,7 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
}
if (ibuf->planes == 32)
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
@@ -364,7 +365,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_getf(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("num_colors", 0); /* "simple" mode */
@@ -460,7 +461,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if (TRACK_VIEW_SELECTED(sc, track)) {
if ((b - a - 1) >= 1) {
- glPointSize(5.0f);
+ GPU_point_size(5.0f);
immBegin(GWN_PRIM_POINTS, b - a - 1);
@@ -475,7 +476,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
if ((b - a) >= 2) {
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
immBegin(GWN_PRIM_LINE_STRIP, b - a);
@@ -488,7 +489,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
if (TRACK_VIEW_SELECTED(sc, track)) {
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
if ((curindex - a) >= 1) {
immUniformThemeColor(TH_PATH_BEFORE);
@@ -515,7 +516,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
}
- glLineWidth(1);
+ GPU_line_width(1);
if ((curindex - a + 1) >= 2) {
immUniformThemeColor(TH_PATH_BEFORE);
@@ -559,7 +560,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
px[0] = 1.0f / width / sc->zoom;
px[1] = 1.0f / height / sc->zoom;
- glLineWidth(tiny ? 1.0f : 3.0f);
+ GPU_line_width(tiny ? 1.0f : 3.0f);
immUniformThemeColor(TH_MARKER_OUTLINE);
@@ -576,7 +577,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
if (isect_point_quad_v2(p, marker->pattern_corners[0], marker->pattern_corners[1],
marker->pattern_corners[2], marker->pattern_corners[3]))
{
- glPointSize(tiny ? 3.0f : 4.0f);
+ GPU_point_size(tiny ? 3.0f : 4.0f);
immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(position, pos[0], pos[1]);
@@ -660,7 +661,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
px[0] = 1.0f / width / sc->zoom;
px[1] = 1.0f / height / sc->zoom;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
/* Since we are switching solid and dashed lines in rather complex logic here, just always go with dashed shader. */
immUnbindProgram();
@@ -668,7 +669,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_getf(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("num_colors", 0); /* "simple" mode */
@@ -700,7 +701,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
if (isect_point_quad_v2(p, marker->pattern_corners[0], marker->pattern_corners[1],
marker->pattern_corners[2], marker->pattern_corners[3]))
{
- glPointSize(tiny ? 1.0f : 2.0f);
+ GPU_point_size(tiny ? 1.0f : 2.0f);
immUniform1f("dash_factor", 2.0f); /* Solid "line" */
@@ -932,7 +933,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
- glLineWidth(outline ? 3.0f : 1.0f);
+ GPU_line_width(outline ? 3.0f : 1.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, 0.0f, 0.0f);
@@ -1125,8 +1126,8 @@ static void draw_plane_marker_image(Scene *scene,
if (plane_track->image_opacity != 1.0f || ibuf->planes == 32) {
transparent = true;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
glGenTextures(1, (GLuint *)&texid);
@@ -1174,7 +1175,7 @@ static void draw_plane_marker_image(Scene *scene,
glBindTexture(GL_TEXTURE_2D, 0);
if (transparent) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -1210,7 +1211,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_getf(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("num_colors", 0); /* "simple" mode */
@@ -1219,7 +1220,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
const bool stipple = !draw_outline && tiny;
const bool thick = draw_outline && !tiny;
- glLineWidth(thick ? 3.0f : 1.0f);
+ GPU_line_width(thick ? 3.0f : 1.0f);
if (stipple) {
immUniform1f("dash_width", 6.0f);
@@ -1483,7 +1484,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
float pos[4], vec[4], mat[4][4], aspy;
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
aspy = 1.0f / clip->tracking.camera.pixel_aspect;
BKE_tracking_get_projection_matrix(tracking, object, framenr, width, height, mat);
@@ -1711,8 +1712,8 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
immUniformColor4fv(layer->color);
- glLineWidth(layer->thickness);
- glPointSize((float)(layer->thickness + 2));
+ GPU_line_width(layer->thickness);
+ GPU_point_size((float)(layer->thickness + 2));
while (frame) {
bGPDstroke *stroke = frame->strokes.first;
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 8d29cb73a68..d463f585470 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -45,6 +45,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_types.h"
@@ -80,11 +81,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track,
if (track == data->act_track) {
col[3] = 1.0f;
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
}
else {
col[3] = 0.5f;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
immUniformColor4fv(col);
@@ -152,13 +153,13 @@ static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc, unsigned int p
(sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
&userdata, tracking_segment_knot_cb, NULL, NULL);
/* draw graph lines */
- glEnable(GL_BLEND);
+ GPU_blend(true);
clip_graph_tracking_values_iterate(sc,
(sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,
(sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
&userdata, tracking_segment_point_cb, tracking_segment_start_cb,
tracking_segment_end_cb);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* selected knot handles on top of curves */
userdata.sel = true;
@@ -226,11 +227,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *
if (track == data->active_track) {
col[3] = 1.0f;
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
}
else {
col[3] = 0.5f;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
immUniformColor4fv(col);
@@ -330,7 +331,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) {
draw_tracks_motion_curves(v2d, sc, pos);
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index a666b20dfa4..c3208260b3b 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -46,6 +46,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -269,8 +270,8 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
UI_view2d_view_ortho(v2d);
/* currently clip editor supposes that editing clip length is equal to scene frame range */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -279,12 +280,12 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUniformThemeColorShade(TH_BACK, -60);
/* thin lines where the actual frames are */
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, (float)SFRA, v2d->cur.ymin);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index b050e991140..2e98e3cec5c 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -63,6 +63,7 @@
#include "GPU_glew.h"
#include "GPU_matrix.h"
+#include "GPU_framebuffer.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1146,7 +1147,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
/* data... */
movieclip_main_area_set_view2d(C, ar);
@@ -1253,7 +1254,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1295,7 +1296,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1368,7 +1369,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);