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:
authorTon Roosendaal <ton@blender.org>2006-03-09 13:13:37 +0300
committerTon Roosendaal <ton@blender.org>2006-03-09 13:13:37 +0300
commitef346ebd33600fb58e69c547af7f3d6bcf94abcb (patch)
treedd5a4f259c364b127a39ab21ff7a79e37971ad46 /source/blender/src/renderwin.c
parentaa31da2abf83eebe4c006e99146d072a4e01b097 (diff)
<sob>dropping OpenGL float buffer drawing... it seems that this isn't
a well supported feature for glDrawPixels(), especially on ATIs crashes happen with it irregularly. (note; drawing float is a regular opengl 1.0 feature...). Now all scanline/part updates in renderwindow is converted to 32 bits before drawing, also the in the UV Image window only 32 bits RGBA is drawn. What is still float: drawing the final image after render in renderwindow, and drawing the Z or Alpha in renderwindow and UV image. Of course we need to test this first. :) Will await reports...
Diffstat (limited to 'source/blender/src/renderwin.c')
-rw-r--r--source/blender/src/renderwin.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
index bea32212779..2562111e59f 100644
--- a/source/blender/src/renderwin.c
+++ b/source/blender/src/renderwin.c
@@ -743,6 +743,34 @@ static void renderwin_clear_display_cb(RenderResult *rr)
}
}
+#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
+static void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, int format, int type, float *rectf)
+{
+ float *rf;
+ int x, y;
+ char *rect32, *rc;
+
+ /* copy imgw-imgh to a temporal 32 bits rect */
+ if(img_w<1 || img_h<1) return;
+
+ rc= rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits");
+
+ for(y=0; y<img_h; y++) {
+ rf= rectf;
+ for(x=0; x<img_w; x++, rf+=4, rc+=4) {
+ rc[0]= FTOCHAR(rf[0]);
+ rc[1]= FTOCHAR(rf[1]);
+ rc[2]= FTOCHAR(rf[2]);
+ rc[3]= FTOCHAR(rf[3]);
+ }
+ rectf+= 4*row_w;
+ }
+
+ glaDrawPixelsSafe(fx, fy, img_w, img_h, img_w, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
+
+ MEM_freeN(rect32);
+}
+
/* XXX, this is not good, we do this without any regard to state
* ... better is to make this an optimization of a more clear
* implementation. the bug shows up when you do something like
@@ -809,7 +837,7 @@ static void renderwin_progress(RenderWin *rw, RenderResult *rr, volatile rcti *r
glDrawBuffer(GL_FRONT);
#endif
glPixelZoom(rw->zoom, rw->zoom);
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rr->rectx-2*rr->crop, ymax, rr->rectx,
+ glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], rr->rectx-2*rr->crop, ymax, rr->rectx,
GL_RGBA, GL_FLOAT, rectf);
glPixelZoom(1.0, 1.0);
@@ -969,7 +997,7 @@ static void init_test_break_callback()
tmevalue.it_interval.tv_sec = 0;
tmevalue.it_interval.tv_usec = 250000;
- /* wanneer de eerste ? */
+ /* when the first ? */
tmevalue.it_value.tv_sec = 0;
tmevalue.it_value.tv_usec = 10000;