From 4e93ac546f4463cae4a6c54e2319e6a0b4d28e8e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Mar 2013 08:53:01 +0000 Subject: Use checker backdrop for footage with alpha channel in clip editor Also use glaDrawPixelsAuto as a fallback method. Hopefully it'll make using 2D textures for frames higher resolution than GL_MAX_TEXTURE_SIZE. --- source/blender/editors/space_clip/clip_draw.c | 15 ++++++++++++++- source/blender/editors/space_clip/clip_editor.c | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_clip') diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 58626c79363..4678351c0ac 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -269,8 +269,18 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar, if (display_buffer) { int need_fallback = 1; + /* checkerboard for case alpha */ + if (ibuf->planes == 32) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + fdrawcheckerboard(x, y, x + zoomx * ibuf->x, y + zoomy * ibuf->y); + } + if (ED_space_clip_texture_buffer_supported(sc)) { if (ED_space_clip_load_movieclip_buffer(sc, ibuf, display_buffer)) { + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glPushMatrix(); glTranslatef(x, y, 0.0f); glScalef(zoomx, zoomy, 1.0f); @@ -296,11 +306,14 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar, /* set zoom */ glPixelZoom(zoomx * width / ibuf->x, zoomy * height / ibuf->y); - glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer); + glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer); /* reset zoom */ glPixelZoom(1.0f, 1.0f); } + + if (ibuf->planes == 32) + glDisable(GL_BLEND); } IMB_display_buffer_release(cache_handle); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 728110dfeee..e2102920298 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -617,6 +617,8 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign context->last_texture = glaGetOneInteger(GL_TEXTURE_2D); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + /* image texture need to be rebinded if displaying another image buffer * assuming displaying happens of footage frames only on which painting doesn't happen. * so not changed image buffer pointer means unchanged image content */ -- cgit v1.2.3