diff options
author | Ton Roosendaal <ton@blender.org> | 2004-10-03 20:54:05 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-10-03 20:54:05 +0400 |
commit | b7ac42a4c60307a6d95913bfb7a04cec55013ca6 (patch) | |
tree | 1356eccf862f39f5bfce1eed8d95152a9a859634 /source/blender/src/interface.c | |
parent | 3a840670a52701e8690a5d201bcb57eac45e2c8a (diff) |
Test for people which copybuffer method is best.
G.rt==2: uses a glReadPixel and glDrawPixel together
Otherwise it uses glCopyPixel (supposed to be faster :)
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r-- | source/blender/src/interface.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 3e791702958..f96ccd6f6cd 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -212,6 +212,17 @@ void ui_end_overdraw(OverDraw *od); */ +static void myglCopyPixels(int a, int b, int c, int d, int e) +{ + if(G.rt==2) { + unsigned int *buf= MEM_mallocN(4*c*d, "temp glcopypixels"); + glReadPixels(a, b, c, d, GL_RGBA, GL_UNSIGNED_BYTE, buf); + glDrawPixels(c, d, GL_RGBA, GL_UNSIGNED_BYTE, buf); + MEM_freeN(buf); + } + else glCopyPixels(a, b, c, d, e); +} + typedef struct { short x, y, sx, sy, oldwin; unsigned int *rect; @@ -260,9 +271,10 @@ static void ui_flush_overdraw(uiOverDraw *od) if(od==NULL) return; glDisable(GL_DITHER); + glReadBuffer(GL_BACK); glDrawBuffer(GL_FRONT); glRasterPos2s(od->x, od->y); - glCopyPixels(od->x, od->y, od->sx, od->sy, GL_COLOR); + myglCopyPixels(od->x, od->y, od->sx, od->sy, GL_COLOR); glEnable(GL_DITHER); glFlush(); glDrawBuffer(GL_BACK); @@ -320,9 +332,10 @@ void ui_block_flush_back(uiBlock *block) mywinset(G.curscreen->mainwin); glDisable(GL_DITHER); + glReadBuffer(GL_BACK); glDrawBuffer(GL_FRONT); glRasterPos2i(minx, miny); - glCopyPixels(minx, miny, sizex, sizey, GL_COLOR); + myglCopyPixels(minx, miny, sizex, sizey, GL_COLOR); glEnable(GL_DITHER); glFlush(); glDrawBuffer(GL_BACK); |