[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60402] trunk/blender/source/blender/ editors/screen/screendump.c: Fix #36826: make screencast with quicktime output gave black flickering areas.
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri Sep 27 22:29:07 CEST 2013
Revision: 60402
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60402
Author: blendix
Date: 2013-09-27 20:29:07 +0000 (Fri, 27 Sep 2013)
Log Message:
-----------
Fix #36826: make screencast with quicktime output gave black flickering areas.
Problem was OpenGL buffer alpha channel, it's not used in most places and so
not set to any meaningful value while drawing.
Modified Paths:
--------------
trunk/blender/source/blender/editors/screen/screendump.c
Modified: trunk/blender/source/blender/editors/screen/screendump.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screendump.c 2013-09-27 19:44:06 UTC (rev 60401)
+++ trunk/blender/source/blender/editors/screen/screendump.c 2013-09-27 20:29:07 UTC (rev 60402)
@@ -77,6 +77,18 @@
ImageFormatData im_format;
} ScreenshotData;
+static void screenshot_read_pixels(int x, int y, int w, int h, unsigned char *rect)
+{
+ int i;
+
+ glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ glFinish();
+
+ /* clear alpha, it is not set to a meaningful value in opengl */
+ for (i = 0, rect += 3; i < w*h; i++, rect += 4)
+ *rect = 255;
+}
+
/* get shot from frontbuffer */
static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy)
{
@@ -93,8 +105,7 @@
dumprect = MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
glReadBuffer(GL_FRONT);
- glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
- glFinish();
+ screenshot_read_pixels(x, y, *dumpsx, *dumpsy, (unsigned char*)dumprect);
glReadBuffer(GL_BACK);
}
@@ -316,8 +327,7 @@
if (sj->dumprect == NULL) {
dumprect = MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
- glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
- glFinish();
+ screenshot_read_pixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, (unsigned char*)dumprect);
sj->dumprect = dumprect;
}
More information about the Bf-blender-cvs
mailing list