[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55404] trunk/blender/source/blender/ editors/space_clip: Use checker backdrop for footage with alpha channel in clip editor

Sergey Sharybin sergey.vfx at gmail.com
Tue Mar 19 09:53:02 CET 2013


Revision: 55404
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55404
Author:   nazgul
Date:     2013-03-19 08:53:01 +0000 (Tue, 19 Mar 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_clip/clip_draw.c
    trunk/blender/source/blender/editors/space_clip/clip_editor.c

Modified: trunk/blender/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_draw.c	2013-03-19 08:33:24 UTC (rev 55403)
+++ trunk/blender/source/blender/editors/space_clip/clip_draw.c	2013-03-19 08:53:01 UTC (rev 55404)
@@ -269,8 +269,18 @@
 		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 @@
 				/* 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);

Modified: trunk/blender/source/blender/editors/space_clip/clip_editor.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_editor.c	2013-03-19 08:33:24 UTC (rev 55403)
+++ trunk/blender/source/blender/editors/space_clip/clip_editor.c	2013-03-19 08:53:01 UTC (rev 55404)
@@ -617,6 +617,8 @@
 
 	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 */




More information about the Bf-blender-cvs mailing list