From f3966dda4e0a03c16206cfbf176f222e13a784c1 Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Thu, 29 May 2008 09:00:49 +0000 Subject: [PATCH] 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 --- .../intern/app_blender/AppGLWidget.h | 4 +++ .../freestyle/intern/app_blender/api.cpp | 32 +++++++++++-------- 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; yresult->renlay = render_get_active_layer(re, re->result); re->display_draw(re->result, NULL);