[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15044] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/app_blender: 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

Maxime Curioni maxime.curioni at gmail.com
Thu May 29 11:00:50 CEST 2008


Revision: 15044
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15044
Author:   mxcurioni
Date:     2008-05-29 11:00:49 +0200 (Thu, 29 May 2008)

Log Message:
-----------
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

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h	2008-05-29 06:14:53 UTC (rev 15043)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h	2008-05-29 09:00:49 UTC (rev 15044)
@@ -329,6 +329,7 @@
 
   /*! glReadPixels */
   typedef enum{
+	RGBA,
     RGB,
     DEPTH
   } PixelFormat;
@@ -345,6 +346,9 @@
     GLenum glformat;
     switch(format)
     {
+	    case RGBA:
+	      glformat = GL_RGBA;
+	      break;
     case RGB:
       glformat = GL_RGB;
       break;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-05-29 06:14:53 UTC (rev 15043)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-05-29 09:00:49 UTC (rev 15044)
@@ -48,22 +48,26 @@
 
 		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 );
 		
-		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;
-			}
-		}
+		// 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;
+		// 	}
+		// }
+		// 
 		
+		
 		re->result->renlay = render_get_active_layer(re, re->result);
 		re->display_draw(re->result, NULL);
 		





More information about the Bf-blender-cvs mailing list