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:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-05-29 13:00:49 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-05-29 13:00:49 +0400
commitf3966dda4e0a03c16206cfbf176f222e13a784c1 (patch)
tree6d6aad0c9f49df5dab9e3df2c6b1f338dcd14db5 /source/blender/freestyle/intern/app_blender
parent4b7174a6dd18d83b4d359f3e86df8a6f7a6edd7a (diff)
soc-2008-mxcurioni: made the image rendering faster by reading the frame buffer directly into the RenderResult's ImBuf structure, removing the need to copy it manually
Diffstat (limited to 'source/blender/freestyle/intern/app_blender')
-rwxr-xr-xsource/blender/freestyle/intern/app_blender/AppGLWidget.h4
-rw-r--r--source/blender/freestyle/intern/app_blender/api.cpp32
2 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/app_blender/AppGLWidget.h b/source/blender/freestyle/intern/app_blender/AppGLWidget.h
index 15238ba6269..eb233bfcb7d 100755
--- a/source/blender/freestyle/intern/app_blender/AppGLWidget.h
+++ b/source/blender/freestyle/intern/app_blender/AppGLWidget.h
@@ -329,6 +329,7 @@ public:
/*! glReadPixels */
typedef enum{
+ RGBA,
RGB,
DEPTH
} PixelFormat;
@@ -345,6 +346,9 @@ public:
GLenum glformat;
switch(format)
{
+ case RGBA:
+ glformat = GL_RGBA;
+ break;
case RGB:
glformat = GL_RGB;
break;
diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp
index d842e59d31b..906522b059e 100644
--- a/source/blender/freestyle/intern/app_blender/api.cpp
+++ b/source/blender/freestyle/intern/app_blender/api.cpp
@@ -48,21 +48,25 @@ extern "C" {
RenderResult rres;
RE_GetResultImage(re, &rres);
- float *rgb = new float[3*width*height];
- view->readPixels(0,0,width,height,AppGLWidget::RGB, rgb);
+ view->readPixels(0,0,width,height,AppGLWidget::RGBA, rres.rectf );
+
+ // float *rgb = new float[3*width*height];
+ // view->readPixels(0,0,width,height,AppGLWidget::RGB, rgb);
+ //
+ // for (unsigned short y=0; y<height; y++) {
+ // float* bpt = (float*)rres.rectf + ((y*width) << 2);
+ // for (unsigned short x=0; x<width; x++) {
+ // float *pos = rgb + 3 * ( y*width + x );
+ //
+ // bpt[0] = pos[0]; // r
+ // bpt[1] = pos[1]; // g
+ // bpt[2] = pos[2]; // b
+ // bpt[3] = 1.0; // a
+ // bpt += 4;
+ // }
+ // }
+ //
- for (unsigned short y=0; y<height; y++) {
- float* bpt = (float*)rres.rectf + ((y*width) << 2);
- for (unsigned short x=0; x<width; x++) {
- float *pos = rgb + 3 * ( y*width + x );
-
- bpt[0] = pos[0]; // r
- bpt[1] = pos[1]; // g
- bpt[2] = pos[2]; // b
- bpt[3] = 1.0; // a
- bpt += 4;
- }
- }
re->result->renlay = render_get_active_layer(re, re->result);
re->display_draw(re->result, NULL);