diff options
author | Ton Roosendaal <ton@blender.org> | 2006-06-17 21:07:49 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-06-17 21:07:49 +0400 |
commit | 7784ea53bf3865c0cf6725611034da771b4535bf (patch) | |
tree | 4462e4e9d2b318e5ab8bbfcd255b2d1b7d7311b2 /source/blender/src/renderwin.c | |
parent | e7af9c48398ad0f03994ccedddbc372263c8e011 (diff) |
Also for new 'to image window' rendering, drawing of float buffers while
rendering now is full 32 bits. This gives drawing issues in some cards,
like ATIs.
Copied the function used for renderwindow to glutil.c, and used now in the
image window.
Diffstat (limited to 'source/blender/src/renderwin.c')
-rw-r--r-- | source/blender/src/renderwin.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index a9fb0f352f2..25ec97f6b14 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -750,35 +750,6 @@ 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; - - /* happens during threaded render... */ - rc= rect32= MEM_mallocT(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_freeT(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 @@ -862,7 +833,7 @@ static void renderwin_progress(RenderWin *rw, RenderResult *rr, volatile rcti *r if(rect32) glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], xmax, ymax, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect32); else - glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], xmax, ymax, rr->rectx, GL_RGBA, GL_FLOAT, rectf); + glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], xmax, ymax, rr->rectx, rectf); glPixelZoom(1.0, 1.0); |