|
Blender
V2.59
|
00001 /* 00002 * $Id: interface_draw.c 37986 2011-06-30 15:02:03Z ton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * Contributor(s): Blender Foundation 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #include <math.h> 00034 #include <string.h> 00035 00036 #include "DNA_color_types.h" 00037 #include "DNA_object_types.h" 00038 #include "DNA_screen_types.h" 00039 00040 #include "BLI_math.h" 00041 #include "BLI_rect.h" 00042 #include "BLI_utildefines.h" 00043 00044 #include "BKE_colortools.h" 00045 #include "BKE_texture.h" 00046 00047 00048 #include "IMB_imbuf.h" 00049 #include "IMB_imbuf_types.h" 00050 00051 #include "BIF_gl.h" 00052 #include "BIF_glutil.h" 00053 00054 #include "BLF_api.h" 00055 00056 #include "UI_interface.h" 00057 00058 /* own include */ 00059 #include "interface_intern.h" 00060 00061 #define UI_RB_ALPHA 16 00062 #define UI_DISABLED_ALPHA_OFFS -160 00063 00064 static int roundboxtype= 15; 00065 00066 void uiSetRoundBox(int type) 00067 { 00068 /* Not sure the roundbox function is the best place to change this 00069 * if this is undone, its not that big a deal, only makes curves edges 00070 * square for the */ 00071 roundboxtype= type; 00072 00073 /* flags to set which corners will become rounded: 00074 00075 1------2 00076 | | 00077 8------4 00078 */ 00079 00080 } 00081 00082 int uiGetRoundBox(void) 00083 { 00084 return roundboxtype; 00085 } 00086 00087 void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad) 00088 { 00089 float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, 00090 {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; 00091 int a; 00092 00093 /* mult */ 00094 for(a=0; a<7; a++) { 00095 vec[a][0]*= rad; vec[a][1]*= rad; 00096 } 00097 00098 glBegin(mode); 00099 00100 /* start with corner right-bottom */ 00101 if(roundboxtype & 4) { 00102 glVertex2f(maxx-rad, miny); 00103 for(a=0; a<7; a++) { 00104 glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); 00105 } 00106 glVertex2f(maxx, miny+rad); 00107 } 00108 else glVertex2f(maxx, miny); 00109 00110 /* corner right-top */ 00111 if(roundboxtype & 2) { 00112 glVertex2f(maxx, maxy-rad); 00113 for(a=0; a<7; a++) { 00114 glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); 00115 } 00116 glVertex2f(maxx-rad, maxy); 00117 } 00118 else glVertex2f(maxx, maxy); 00119 00120 /* corner left-top */ 00121 if(roundboxtype & 1) { 00122 glVertex2f(minx+rad, maxy); 00123 for(a=0; a<7; a++) { 00124 glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); 00125 } 00126 glVertex2f(minx, maxy-rad); 00127 } 00128 else glVertex2f(minx, maxy); 00129 00130 /* corner left-bottom */ 00131 if(roundboxtype & 8) { 00132 glVertex2f(minx, miny+rad); 00133 for(a=0; a<7; a++) { 00134 glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); 00135 } 00136 glVertex2f(minx+rad, miny); 00137 } 00138 else glVertex2f(minx, miny); 00139 00140 glEnd(); 00141 } 00142 00143 static void round_box_shade_col(float *col1, float *col2, float fac) 00144 { 00145 float col[4]; 00146 00147 col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]); 00148 col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]); 00149 col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]); 00150 col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]); 00151 glColor4fv(col); 00152 } 00153 00154 00155 /* linear horizontal shade within button or in outline */ 00156 /* view2d scrollers use it */ 00157 void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown) 00158 { 00159 float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, 00160 {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; 00161 float div= maxy-miny; 00162 float coltop[4], coldown[4], color[4]; 00163 int a; 00164 00165 /* mult */ 00166 for(a=0; a<7; a++) { 00167 vec[a][0]*= rad; vec[a][1]*= rad; 00168 } 00169 /* get current color, needs to be outside of glBegin/End */ 00170 glGetFloatv(GL_CURRENT_COLOR, color); 00171 00172 /* 'shade' defines strength of shading */ 00173 coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f; 00174 coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f; 00175 coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f; 00176 coltop[3]= color[3]; 00177 coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f; 00178 coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f; 00179 coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f; 00180 coldown[3]= color[3]; 00181 00182 glShadeModel(GL_SMOOTH); 00183 glBegin(mode); 00184 00185 /* start with corner right-bottom */ 00186 if(roundboxtype & 4) { 00187 00188 round_box_shade_col(coltop, coldown, 0.0); 00189 glVertex2f(maxx-rad, miny); 00190 00191 for(a=0; a<7; a++) { 00192 round_box_shade_col(coltop, coldown, vec[a][1]/div); 00193 glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); 00194 } 00195 00196 round_box_shade_col(coltop, coldown, rad/div); 00197 glVertex2f(maxx, miny+rad); 00198 } 00199 else { 00200 round_box_shade_col(coltop, coldown, 0.0); 00201 glVertex2f(maxx, miny); 00202 } 00203 00204 /* corner right-top */ 00205 if(roundboxtype & 2) { 00206 00207 round_box_shade_col(coltop, coldown, (div-rad)/div); 00208 glVertex2f(maxx, maxy-rad); 00209 00210 for(a=0; a<7; a++) { 00211 round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div); 00212 glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); 00213 } 00214 round_box_shade_col(coltop, coldown, 1.0); 00215 glVertex2f(maxx-rad, maxy); 00216 } 00217 else { 00218 round_box_shade_col(coltop, coldown, 1.0); 00219 glVertex2f(maxx, maxy); 00220 } 00221 00222 /* corner left-top */ 00223 if(roundboxtype & 1) { 00224 00225 round_box_shade_col(coltop, coldown, 1.0); 00226 glVertex2f(minx+rad, maxy); 00227 00228 for(a=0; a<7; a++) { 00229 round_box_shade_col(coltop, coldown, (div-vec[a][1])/div); 00230 glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); 00231 } 00232 00233 round_box_shade_col(coltop, coldown, (div-rad)/div); 00234 glVertex2f(minx, maxy-rad); 00235 } 00236 else { 00237 round_box_shade_col(coltop, coldown, 1.0); 00238 glVertex2f(minx, maxy); 00239 } 00240 00241 /* corner left-bottom */ 00242 if(roundboxtype & 8) { 00243 00244 round_box_shade_col(coltop, coldown, rad/div); 00245 glVertex2f(minx, miny+rad); 00246 00247 for(a=0; a<7; a++) { 00248 round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div); 00249 glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); 00250 } 00251 00252 round_box_shade_col(coltop, coldown, 0.0); 00253 glVertex2f(minx+rad, miny); 00254 } 00255 else { 00256 round_box_shade_col(coltop, coldown, 0.0); 00257 glVertex2f(minx, miny); 00258 } 00259 00260 glEnd(); 00261 glShadeModel(GL_FLAT); 00262 } 00263 00264 /* linear vertical shade within button or in outline */ 00265 /* view2d scrollers use it */ 00266 void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight) 00267 { 00268 float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, 00269 {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; 00270 float div= maxx-minx; 00271 float colLeft[3], colRight[3], color[4]; 00272 int a; 00273 00274 /* mult */ 00275 for(a=0; a<7; a++) { 00276 vec[a][0]*= rad; vec[a][1]*= rad; 00277 } 00278 /* get current color, needs to be outside of glBegin/End */ 00279 glGetFloatv(GL_CURRENT_COLOR, color); 00280 00281 /* 'shade' defines strength of shading */ 00282 colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0f) colLeft[0]= 1.0f; 00283 colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0f) colLeft[1]= 1.0f; 00284 colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0f) colLeft[2]= 1.0f; 00285 colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0f) colRight[0]= 0.0f; 00286 colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0f) colRight[1]= 0.0f; 00287 colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0f) colRight[2]= 0.0f; 00288 00289 glShadeModel(GL_SMOOTH); 00290 glBegin(mode); 00291 00292 /* start with corner right-bottom */ 00293 if(roundboxtype & 4) { 00294 round_box_shade_col(colLeft, colRight, 0.0); 00295 glVertex2f(maxx-rad, miny); 00296 00297 for(a=0; a<7; a++) { 00298 round_box_shade_col(colLeft, colRight, vec[a][0]/div); 00299 glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); 00300 } 00301 00302 round_box_shade_col(colLeft, colRight, rad/div); 00303 glVertex2f(maxx, miny+rad); 00304 } 00305 else { 00306 round_box_shade_col(colLeft, colRight, 0.0); 00307 glVertex2f(maxx, miny); 00308 } 00309 00310 /* corner right-top */ 00311 if(roundboxtype & 2) { 00312 round_box_shade_col(colLeft, colRight, 0.0); 00313 glVertex2f(maxx, maxy-rad); 00314 00315 for(a=0; a<7; a++) { 00316 00317 round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])/div); 00318 glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); 00319 } 00320 round_box_shade_col(colLeft, colRight, (div-rad)/div); 00321 glVertex2f(maxx-rad, maxy); 00322 } 00323 else { 00324 round_box_shade_col(colLeft, colRight, 0.0); 00325 glVertex2f(maxx, maxy); 00326 } 00327 00328 /* corner left-top */ 00329 if(roundboxtype & 1) { 00330 round_box_shade_col(colLeft, colRight, (div-rad)/div); 00331 glVertex2f(minx+rad, maxy); 00332 00333 for(a=0; a<7; a++) { 00334 round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])/div); 00335 glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); 00336 } 00337 00338 round_box_shade_col(colLeft, colRight, 1.0); 00339 glVertex2f(minx, maxy-rad); 00340 } 00341 else { 00342 round_box_shade_col(colLeft, colRight, 1.0); 00343 glVertex2f(minx, maxy); 00344 } 00345 00346 /* corner left-bottom */ 00347 if(roundboxtype & 8) { 00348 round_box_shade_col(colLeft, colRight, 1.0); 00349 glVertex2f(minx, miny+rad); 00350 00351 for(a=0; a<7; a++) { 00352 round_box_shade_col(colLeft, colRight, (vec[a][0])/div); 00353 glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); 00354 } 00355 00356 round_box_shade_col(colLeft, colRight, 1.0); 00357 glVertex2f(minx+rad, miny); 00358 } 00359 else { 00360 round_box_shade_col(colLeft, colRight, 1.0); 00361 glVertex2f(minx, miny); 00362 } 00363 00364 glEnd(); 00365 glShadeModel(GL_FLAT); 00366 } 00367 00368 /* plain antialiased unfilled rectangle */ 00369 void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) 00370 { 00371 float color[4]; 00372 00373 if(roundboxtype & UI_RB_ALPHA) { 00374 glGetFloatv(GL_CURRENT_COLOR, color); 00375 color[3]= 0.5; 00376 glColor4fv(color); 00377 glEnable( GL_BLEND ); 00378 } 00379 00380 /* set antialias line */ 00381 glEnable( GL_LINE_SMOOTH ); 00382 glEnable( GL_BLEND ); 00383 00384 uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); 00385 00386 glDisable( GL_BLEND ); 00387 glDisable( GL_LINE_SMOOTH ); 00388 } 00389 00390 /* plain fake antialiased unfilled round rectangle */ 00391 #if 0 /* UNUSED 2.5 */ 00392 static void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp) 00393 { 00394 float color[4], alpha; 00395 float raddiff; 00396 int i, passes=4; 00397 00398 /* get the color and divide up the alpha */ 00399 glGetFloatv(GL_CURRENT_COLOR, color); 00400 alpha = 1; //color[3]; 00401 color[3]= 0.5*alpha/(float)passes; 00402 glColor4fv(color); 00403 00404 /* set the 'jitter amount' */ 00405 raddiff = (1/(float)passes) * asp; 00406 00407 glEnable( GL_BLEND ); 00408 00409 /* draw lots of lines on top of each other */ 00410 for (i=passes; i>=(-passes); i--) { 00411 uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad+(i*raddiff)); 00412 } 00413 00414 glDisable( GL_BLEND ); 00415 00416 color[3] = alpha; 00417 glColor4fv(color); 00418 } 00419 #endif 00420 00421 /* (old, used in outliner) plain antialiased filled box */ 00422 void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) 00423 { 00424 float color[4]; 00425 00426 if(roundboxtype & UI_RB_ALPHA) { 00427 glGetFloatv(GL_CURRENT_COLOR, color); 00428 color[3]= 0.5; 00429 glColor4fv(color); 00430 glEnable( GL_BLEND ); 00431 } 00432 00433 /* solid part */ 00434 uiDrawBox(GL_POLYGON, minx, miny, maxx, maxy, rad); 00435 00436 /* set antialias line */ 00437 glEnable( GL_LINE_SMOOTH ); 00438 glEnable( GL_BLEND ); 00439 00440 uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); 00441 00442 glDisable( GL_BLEND ); 00443 glDisable( GL_LINE_SMOOTH ); 00444 } 00445 00446 00447 /* ************** generic embossed rect, for window sliders etc ************* */ 00448 00449 00450 /* text_draw.c uses this */ 00451 void uiEmboss(float x1, float y1, float x2, float y2, int sel) 00452 { 00453 00454 /* below */ 00455 if(sel) glColor3ub(200,200,200); 00456 else glColor3ub(50,50,50); 00457 fdrawline(x1, y1, x2, y1); 00458 00459 /* right */ 00460 fdrawline(x2, y1, x2, y2); 00461 00462 /* top */ 00463 if(sel) glColor3ub(50,50,50); 00464 else glColor3ub(200,200,200); 00465 fdrawline(x1, y2, x2, y2); 00466 00467 /* left */ 00468 fdrawline(x1, y1, x1, y2); 00469 00470 } 00471 00472 /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ 00473 00474 void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) 00475 { 00476 #ifdef WITH_HEADLESS 00477 (void)rect; 00478 #else 00479 extern char datatoc_splash_png[]; 00480 extern int datatoc_splash_png_size; 00481 ImBuf *ibuf; 00482 //GLint scissor[4]; 00483 //int w, h; 00484 00485 /* hardcoded to splash, loading and freeing every draw, eek! */ 00486 ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect); 00487 00488 if (!ibuf) return; 00489 00490 /* scissor doesn't seem to be doing the right thing...? 00491 //glColor4f(1.0, 0.f, 0.f, 1.f); 00492 //fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax) 00493 00494 w = (rect->xmax - rect->xmin); 00495 h = (rect->ymax - rect->ymin); 00496 // prevent drawing outside widget area 00497 glGetIntegerv(GL_SCISSOR_BOX, scissor); 00498 glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h); 00499 */ 00500 00501 glEnable(GL_BLEND); 00502 glColor4f(0.0, 0.0, 0.0, 0.0); 00503 00504 glaDrawPixelsSafe((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); 00505 //glaDrawPixelsTex((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect); 00506 00507 glDisable(GL_BLEND); 00508 00509 /* 00510 // restore scissortest 00511 glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); 00512 */ 00513 00514 IMB_freeImBuf(ibuf); 00515 #endif 00516 } 00517 00518 #if 0 00519 #ifdef INTERNATIONAL 00520 static void ui_draw_but_CHARTAB(uiBut *but) 00521 { 00522 /* XXX 2.50 bad global access */ 00523 /* Some local variables */ 00524 float sx, sy, ex, ey; 00525 float width, height; 00526 float butw, buth; 00527 int x, y, cs; 00528 wchar_t wstr[2]; 00529 unsigned char ustr[16]; 00530 PackedFile *pf; 00531 int result = 0; 00532 int charmax = G.charmax; 00533 00534 /* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */ 00535 if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) 00536 { 00537 if(G.ui_international == TRUE) 00538 { 00539 charmax = 0xff; 00540 } 00541 else 00542 { 00543 charmax = 0xff; 00544 } 00545 } 00546 00547 /* Category list exited without selecting the area */ 00548 if(G.charmax == 0) 00549 charmax = G.charmax = 0xffff; 00550 00551 /* Calculate the size of the button */ 00552 width = abs(rect->xmax - rect->xmin); 00553 height = abs(rect->ymax - rect->ymin); 00554 00555 butw = floor(width / 12); 00556 buth = floor(height / 6); 00557 00558 /* Initialize variables */ 00559 sx = rect->xmin; 00560 ex = rect->xmin + butw; 00561 sy = rect->ymin + height - buth; 00562 ey = rect->ymin + height; 00563 00564 cs = G.charstart; 00565 00566 /* Set the font, in case it is not FO_BUILTIN_NAME font */ 00567 if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) 00568 { 00569 // Is the font file packed, if so then use the packed file 00570 if(G.selfont->packedfile) 00571 { 00572 pf = G.selfont->packedfile; 00573 FTF_SetFont(pf->data, pf->size, 14.0); 00574 } 00575 else 00576 { 00577 char tmpStr[256]; 00578 int err; 00579 00580 BLI_strncpy(tmpStr, G.selfont->name, sizeof(tmpStr)); 00581 BLI_path_abs(tmpStr, G.main->name); 00582 err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); 00583 } 00584 } 00585 else 00586 { 00587 if(G.ui_international == TRUE) 00588 { 00589 FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0); 00590 } 00591 } 00592 00593 /* Start drawing the button itself */ 00594 glShadeModel(GL_SMOOTH); 00595 00596 glColor3ub(200, 200, 200); 00597 glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); 00598 00599 glColor3ub(0, 0, 0); 00600 for(y = 0; y < 6; y++) 00601 { 00602 // Do not draw more than the category allows 00603 if(cs > charmax) break; 00604 00605 for(x = 0; x < 12; x++) 00606 { 00607 // Do not draw more than the category allows 00608 if(cs > charmax) break; 00609 00610 // Draw one grid cell 00611 glBegin(GL_LINE_LOOP); 00612 glVertex2f(sx, sy); 00613 glVertex2f(ex, sy); 00614 glVertex2f(ex, ey); 00615 glVertex2f(sx, ey); 00616 glEnd(); 00617 00618 // Draw character inside the cell 00619 memset(wstr, 0, sizeof(wchar_t)*2); 00620 memset(ustr, 0, 16); 00621 00622 // Set the font to be either unicode or FO_BUILTIN_NAME 00623 wstr[0] = cs; 00624 if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) 00625 { 00626 wcs2utf8s((char *)ustr, (wchar_t *)wstr); 00627 } 00628 else 00629 { 00630 if(G.ui_international == TRUE) 00631 { 00632 wcs2utf8s((char *)ustr, (wchar_t *)wstr); 00633 } 00634 else 00635 { 00636 ustr[0] = cs; 00637 ustr[1] = 0; 00638 } 00639 } 00640 00641 if((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE)) 00642 { 00643 float wid; 00644 float llx, lly, llz, urx, ury, urz; 00645 float dx, dy; 00646 float px, py; 00647 00648 // Calculate the position 00649 wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8); 00650 FTF_GetBoundingBox((char *) ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8); 00651 dx = urx-llx; 00652 dy = ury-lly; 00653 00654 // This isn't fully functional since the but->aspect isn't working like I suspected 00655 px = sx + ((butw/but->aspect)-dx)/2; 00656 py = sy + ((buth/but->aspect)-dy)/2; 00657 00658 // Set the position and draw the character 00659 ui_rasterpos_safe(px, py, but->aspect); 00660 FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8); 00661 } 00662 else 00663 { 00664 ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect); 00665 UI_DrawString(but->font, (char *) ustr, 0); 00666 } 00667 00668 // Calculate the next position and character 00669 sx += butw; ex +=butw; 00670 cs++; 00671 } 00672 /* Add the y position and reset x position */ 00673 sy -= buth; 00674 ey -= buth; 00675 sx = rect->xmin; 00676 ex = rect->xmin + butw; 00677 } 00678 glShadeModel(GL_FLAT); 00679 00680 /* Return Font Settings to original */ 00681 if(U.fontsize && U.fontname[0]) 00682 { 00683 result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize); 00684 } 00685 else if (U.fontsize) 00686 { 00687 result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize); 00688 } 00689 00690 if (result == 0) 00691 { 00692 result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11); 00693 } 00694 00695 /* resets the font size */ 00696 if(G.ui_international == TRUE) 00697 { 00698 // uiSetCurFont(but->block, UI_HELV); 00699 } 00700 } 00701 00702 #endif // INTERNATIONAL 00703 #endif 00704 00705 static void draw_scope_end(rctf *rect, GLint *scissor) 00706 { 00707 float scaler_x1, scaler_x2; 00708 00709 /* restore scissortest */ 00710 glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); 00711 00712 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 00713 00714 /* scale widget */ 00715 scaler_x1 = rect->xmin + (rect->xmax - rect->xmin)/2 - SCOPE_RESIZE_PAD; 00716 scaler_x2 = rect->xmin + (rect->xmax - rect->xmin)/2 + SCOPE_RESIZE_PAD; 00717 00718 glColor4f(0.f, 0.f, 0.f, 0.25f); 00719 fdrawline(scaler_x1, rect->ymin-4, scaler_x2, rect->ymin-4); 00720 fdrawline(scaler_x1, rect->ymin-7, scaler_x2, rect->ymin-7); 00721 glColor4f(1.f, 1.f, 1.f, 0.25f); 00722 fdrawline(scaler_x1, rect->ymin-5, scaler_x2, rect->ymin-5); 00723 fdrawline(scaler_x1, rect->ymin-8, scaler_x2, rect->ymin-8); 00724 00725 /* outline */ 00726 glColor4f(0.f, 0.f, 0.f, 0.5f); 00727 uiSetRoundBox(15); 00728 uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f); 00729 } 00730 00731 static void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res) 00732 { 00733 int i; 00734 00735 /* under the curve */ 00736 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 00737 glColor4f(r, g, b, alpha); 00738 00739 glShadeModel(GL_FLAT); 00740 glBegin(GL_QUAD_STRIP); 00741 glVertex2f(x, y); 00742 glVertex2f(x, y + (data[0]*h)); 00743 for (i=1; i < res; i++) { 00744 float x2 = x + i * (w/(float)res); 00745 glVertex2f(x2, y + (data[i]*h)); 00746 glVertex2f(x2, y); 00747 } 00748 glEnd(); 00749 00750 /* curve outline */ 00751 glColor4f(0.f, 0.f, 0.f, 0.25f); 00752 00753 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 00754 glEnable(GL_LINE_SMOOTH); 00755 glBegin(GL_LINE_STRIP); 00756 for (i=0; i < res; i++) { 00757 float x2 = x + i * (w/(float)res); 00758 glVertex2f(x2, y + (data[i]*h)); 00759 } 00760 glEnd(); 00761 glDisable(GL_LINE_SMOOTH); 00762 } 00763 00764 void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) 00765 { 00766 Histogram *hist = (Histogram *)but->poin; 00767 int res = hist->x_resolution; 00768 rctf rect; 00769 int i; 00770 float w, h; 00771 //float alpha; 00772 GLint scissor[4]; 00773 00774 rect.xmin = (float)recti->xmin+1; 00775 rect.xmax = (float)recti->xmax-1; 00776 rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2; 00777 rect.ymax = (float)recti->ymax-1; 00778 00779 w = rect.xmax - rect.xmin; 00780 h = (rect.ymax - rect.ymin) * hist->ymax; 00781 00782 glEnable(GL_BLEND); 00783 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 00784 00785 glColor4f(0.f, 0.f, 0.f, 0.3f); 00786 uiSetRoundBox(15); 00787 uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); 00788 00789 glColor4f(1.f, 1.f, 1.f, 0.08f); 00790 /* draw grid lines here */ 00791 for (i=1; i<4; i++) { 00792 fdrawline(rect.xmin, rect.ymin+(i/4.f)*h, rect.xmax, rect.ymin+(i/4.f)*h); 00793 fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax); 00794 } 00795 00796 /* need scissor test, histogram can draw outside of boundary */ 00797 glGetIntegerv(GL_VIEWPORT, scissor); 00798 glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1)); 00799 00800 if (hist->mode == HISTO_MODE_LUMA) 00801 histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res); 00802 else { 00803 if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R) 00804 histogram_draw_one(1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res); 00805 if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G) 00806 histogram_draw_one(0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res); 00807 if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B) 00808 histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res); 00809 } 00810 00811 /* outline, scale gripper */ 00812 draw_scope_end(&rect, scissor); 00813 } 00814 00815 void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) 00816 { 00817 Scopes *scopes = (Scopes *)but->poin; 00818 rctf rect; 00819 int i, c; 00820 float w, w3, h, alpha, yofs; 00821 GLint scissor[4]; 00822 float colors[3][3]= MAT3_UNITY; 00823 float colorsycc[3][3] = {{1,0,1},{1,1,0},{0,1,1}}; 00824 float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */ 00825 float min, max; 00826 00827 if (scopes==NULL) return; 00828 00829 rect.xmin = (float)recti->xmin+1; 00830 rect.xmax = (float)recti->xmax-1; 00831 rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2; 00832 rect.ymax = (float)recti->ymax-1; 00833 00834 if (scopes->wavefrm_yfac < 0.5f ) 00835 scopes->wavefrm_yfac =0.98f; 00836 w = rect.xmax - rect.xmin-7; 00837 h = (rect.ymax - rect.ymin)*scopes->wavefrm_yfac; 00838 yofs= rect.ymin + (rect.ymax - rect.ymin -h)/2.0f; 00839 w3=w/3.0f; 00840 00841 /* log scale for alpha */ 00842 alpha = scopes->wavefrm_alpha*scopes->wavefrm_alpha; 00843 00844 for(c=0; c<3; c++) { 00845 for(i=0; i<3; i++) { 00846 colors_alpha[c][i] = colors[c][i] * alpha; 00847 colorsycc_alpha[c][i] = colorsycc[c][i] * alpha; 00848 } 00849 } 00850 00851 glEnable(GL_BLEND); 00852 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 00853 00854 glColor4f(0.f, 0.f, 0.f, 0.3f); 00855 uiSetRoundBox(15); 00856 uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); 00857 00858 00859 /* need scissor test, waveform can draw outside of boundary */ 00860 glGetIntegerv(GL_VIEWPORT, scissor); 00861 glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1)); 00862 00863 glColor4f(1.f, 1.f, 1.f, 0.08f); 00864 /* draw grid lines here */ 00865 for (i=0; i<6; i++) { 00866 char str[4]; 00867 sprintf(str,"%-3d",i*20); 00868 str[3]='\0'; 00869 fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h); 00870 BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1); 00871 /* in the loop because blf_draw reset it */ 00872 glEnable(GL_BLEND); 00873 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 00874 } 00875 /* 3 vertical separation */ 00876 if (scopes->wavefrm_mode!= SCOPES_WAVEFRM_LUMA) { 00877 for (i=1; i<3; i++) { 00878 fdrawline(rect.xmin+i*w3, rect.ymin, rect.xmin+i*w3, rect.ymax); 00879 } 00880 } 00881 00882 /* separate min max zone on the right */ 00883 fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax); 00884 /* 16-235-240 level in case of ITU-R BT601/709 */ 00885 glColor4f(1.f, 0.4f, 0.f, 0.2f); 00886 if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)){ 00887 fdrawline(rect.xmin+22, yofs+h*16.0f/255.0f, rect.xmax+1, yofs+h*16.0f/255.0f); 00888 fdrawline(rect.xmin+22, yofs+h*235.0f/255.0f, rect.xmin+w3, yofs+h*235.0f/255.0f); 00889 fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f); 00890 fdrawline(rect.xmin+w3, yofs+h*240.0f/255.0f, rect.xmax+1, yofs+h*240.0f/255.0f); 00891 } 00892 /* 7.5 IRE black point level for NTSC */ 00893 if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUMA) 00894 fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f); 00895 00896 if (scopes->ok && scopes->waveform_1 != NULL) { 00897 00898 /* LUMA (1 channel) */ 00899 glBlendFunc(GL_ONE,GL_ONE); 00900 glColor3f(alpha, alpha, alpha); 00901 if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA){ 00902 00903 glBlendFunc(GL_ONE,GL_ONE); 00904 00905 glPushMatrix(); 00906 glEnableClientState(GL_VERTEX_ARRAY); 00907 00908 glTranslatef(rect.xmin, yofs, 0.f); 00909 glScalef(w, h, 0.f); 00910 glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1); 00911 glDrawArrays(GL_POINTS, 0, scopes->waveform_tot); 00912 00913 glDisableClientState(GL_VERTEX_ARRAY); 00914 glPopMatrix(); 00915 00916 /* min max */ 00917 glColor3f(.5f, .5f, .5f); 00918 min= yofs+scopes->minmax[0][0]*h; 00919 max= yofs+scopes->minmax[0][1]*h; 00920 CLAMP(min, rect.ymin, rect.ymax); 00921 CLAMP(max, rect.ymin, rect.ymax); 00922 fdrawline(rect.xmax-3,min,rect.xmax-3,max); 00923 } 00924 00925 /* RGB / YCC (3 channels) */ 00926 else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) { 00927 int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB); 00928 00929 glBlendFunc(GL_ONE,GL_ONE); 00930 00931 glPushMatrix(); 00932 glEnableClientState(GL_VERTEX_ARRAY); 00933 00934 glTranslatef(rect.xmin, yofs, 0.f); 00935 glScalef(w3, h, 0.f); 00936 00937 glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]); 00938 glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1); 00939 glDrawArrays(GL_POINTS, 0, scopes->waveform_tot); 00940 00941 glTranslatef(1.f, 0.f, 0.f); 00942 glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]); 00943 glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2); 00944 glDrawArrays(GL_POINTS, 0, scopes->waveform_tot); 00945 00946 glTranslatef(1.f, 0.f, 0.f); 00947 glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]); 00948 glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3); 00949 glDrawArrays(GL_POINTS, 0, scopes->waveform_tot); 00950 00951 glDisableClientState(GL_VERTEX_ARRAY); 00952 glPopMatrix(); 00953 00954 00955 /* min max */ 00956 for (c=0; c<3; c++) { 00957 if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) 00958 glColor3f(colors[c][0]*0.75f, colors[c][1]*0.75f, colors[c][2]*0.75f); 00959 else 00960 glColor3f(colorsycc[c][0]*0.75f, colorsycc[c][1]*0.75f, colorsycc[c][2]*0.75f); 00961 min= yofs+scopes->minmax[c][0]*h; 00962 max= yofs+scopes->minmax[c][1]*h; 00963 CLAMP(min, rect.ymin, rect.ymax); 00964 CLAMP(max, rect.ymin, rect.ymax); 00965 fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max); 00966 } 00967 } 00968 00969 } 00970 00971 /* outline, scale gripper */ 00972 draw_scope_end(&rect, scissor); 00973 } 00974 00975 static float polar_to_x(float center, float diam, float ampli, float angle) 00976 { 00977 return center + diam * ampli * cosf(angle); 00978 } 00979 00980 static float polar_to_y(float center, float diam, float ampli, float angle) 00981 { 00982 return center + diam * ampli * sinf(angle); 00983 } 00984 00985 static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b) 00986 { 00987 float y,u,v; 00988 float tangle=0.f, tampli; 00989 float dangle, dampli, dangle2, dampli2; 00990 00991 rgb_to_yuv(r,g,b, &y, &u, &v); 00992 if (u>0 && v>=0) tangle=atanf(v/u); 00993 else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI; 00994 else if (u<0) tangle=atanf(v/u) + (float)M_PI; 00995 else if (u==0 && v > 0.0f) tangle= (float)M_PI/2.0f; 00996 else if (u==0 && v < 0.0f) tangle=-(float)M_PI/2.0f; 00997 tampli= sqrtf(u*u+v*v); 00998 00999 /* small target vary by 2.5 degree and 2.5 IRE unit */ 01000 glColor4f(1.0f, 1.0f, 1.0, 0.12f); 01001 dangle= 2.5f*(float)M_PI/180.0f; 01002 dampli= 2.5f/200.0f; 01003 glBegin(GL_LINE_STRIP); 01004 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); 01005 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle), polar_to_y(centery,diam,tampli-dampli,tangle+dangle)); 01006 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle), polar_to_y(centery,diam,tampli-dampli,tangle-dangle)); 01007 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle), polar_to_y(centery,diam,tampli+dampli,tangle-dangle)); 01008 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); 01009 glEnd(); 01010 /* big target vary by 10 degree and 20% amplitude */ 01011 glColor4f(1.0f, 1.0f, 1.0, 0.12f); 01012 dangle= 10.0f*(float)M_PI/180.0f; 01013 dampli= 0.2f*tampli; 01014 dangle2= 5.0f*(float)M_PI/180.0f; 01015 dampli2= 0.5f*dampli; 01016 glBegin(GL_LINE_STRIP); 01017 glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle)); 01018 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); 01019 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle-dangle2), polar_to_y(centery,diam,tampli+dampli,tangle+dangle-dangle2)); 01020 glEnd(); 01021 glBegin(GL_LINE_STRIP); 01022 glVertex2f(polar_to_x(centerx,diam,tampli-dampli+dampli2,tangle+dangle), polar_to_y(centery ,diam,tampli-dampli+dampli2,tangle+dangle)); 01023 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle), polar_to_y(centery,diam,tampli-dampli,tangle+dangle)); 01024 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle-dangle2), polar_to_y(centery,diam,tampli-dampli,tangle+dangle-dangle2)); 01025 glEnd(); 01026 glBegin(GL_LINE_STRIP); 01027 glVertex2f(polar_to_x(centerx,diam,tampli-dampli+dampli2,tangle-dangle), polar_to_y(centery,diam,tampli-dampli+dampli2,tangle-dangle)); 01028 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle), polar_to_y(centery,diam,tampli-dampli,tangle-dangle)); 01029 glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle+dangle2), polar_to_y(centery,diam,tampli-dampli,tangle-dangle+dangle2)); 01030 glEnd(); 01031 glBegin(GL_LINE_STRIP); 01032 glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle-dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle-dangle)); 01033 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle), polar_to_y(centery,diam,tampli+dampli,tangle-dangle)); 01034 glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle+dangle2), polar_to_y(centery,diam,tampli+dampli,tangle-dangle+dangle2)); 01035 glEnd(); 01036 } 01037 01038 void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) 01039 { 01040 Scopes *scopes = (Scopes *)but->poin; 01041 rctf rect; 01042 int i, j; 01043 int skina= 123; /* angle in degree of the skin tone line */ 01044 float w, h, centerx, centery, diam; 01045 float alpha; 01046 float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; 01047 GLint scissor[4]; 01048 01049 rect.xmin = (float)recti->xmin+1; 01050 rect.xmax = (float)recti->xmax-1; 01051 rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2; 01052 rect.ymax = (float)recti->ymax-1; 01053 01054 w = rect.xmax - rect.xmin; 01055 h = rect.ymax - rect.ymin; 01056 centerx = rect.xmin + w/2; 01057 centery = rect.ymin + h/2; 01058 diam= (w<h)?w:h; 01059 01060 alpha = scopes->vecscope_alpha*scopes->vecscope_alpha*scopes->vecscope_alpha; 01061 01062 glEnable(GL_BLEND); 01063 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 01064 01065 glColor4f(0.f, 0.f, 0.f, 0.3f); 01066 uiSetRoundBox(15); 01067 uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); 01068 01069 /* need scissor test, hvectorscope can draw outside of boundary */ 01070 glGetIntegerv(GL_VIEWPORT, scissor); 01071 glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1)); 01072 01073 glColor4f(1.f, 1.f, 1.f, 0.08f); 01074 /* draw grid elements */ 01075 /* cross */ 01076 fdrawline(centerx - (diam/2)-5, centery, centerx + (diam/2)+5, centery); 01077 fdrawline(centerx, centery - (diam/2)-5, centerx, centery + (diam/2)+5); 01078 /* circles */ 01079 for(j=0; j<5; j++) { 01080 glBegin(GL_LINE_STRIP); 01081 for(i=0; i<=360; i=i+15) { 01082 float a= i*M_PI/180.0; 01083 float r= (j+1)/10.0f; 01084 glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); 01085 } 01086 glEnd(); 01087 } 01088 /* skin tone line */ 01089 glColor4f(1.f, 0.4f, 0.f, 0.2f); 01090 fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0), 01091 polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0)); 01092 /* saturation points */ 01093 for(i=0; i<6; i++) 01094 vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]); 01095 01096 if (scopes->ok && scopes->vecscope != NULL) { 01097 /* pixel point cloud */ 01098 glBlendFunc(GL_ONE,GL_ONE); 01099 glColor3f(alpha, alpha, alpha); 01100 01101 glPushMatrix(); 01102 glEnableClientState(GL_VERTEX_ARRAY); 01103 01104 glTranslatef(centerx, centery, 0.f); 01105 glScalef(diam, diam, 0.f); 01106 01107 glVertexPointer(2, GL_FLOAT, 0, scopes->vecscope); 01108 glDrawArrays(GL_POINTS, 0, scopes->waveform_tot); 01109 01110 glDisableClientState(GL_VERTEX_ARRAY); 01111 glPopMatrix(); 01112 } 01113 01114 /* outline, scale gripper */ 01115 draw_scope_end(&rect, scissor); 01116 01117 glDisable(GL_BLEND); 01118 } 01119 01120 void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) 01121 { 01122 ColorBand *coba; 01123 CBData *cbd; 01124 float x1, y1, sizex, sizey; 01125 float v3[2], v1[2], v2[2], v1a[2], v2a[2]; 01126 int a; 01127 float pos, colf[4]= {0,0,0,0}; /* initialize incase the colorband isnt valid */ 01128 01129 coba= (ColorBand *)(but->editcoba? but->editcoba: but->poin); 01130 if(coba==NULL) return; 01131 01132 x1= rect->xmin; 01133 y1= rect->ymin; 01134 sizex= rect->xmax-x1; 01135 sizey= rect->ymax-y1; 01136 01137 /* first background, to show tranparency */ 01138 01139 glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255); 01140 glRectf(x1, y1, x1+sizex, y1+sizey); 01141 glEnable(GL_POLYGON_STIPPLE); 01142 glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255); 01143 glPolygonStipple(checker_stipple_sml); 01144 glRectf(x1, y1, x1+sizex, y1+sizey); 01145 glDisable(GL_POLYGON_STIPPLE); 01146 01147 glShadeModel(GL_FLAT); 01148 glEnable(GL_BLEND); 01149 01150 cbd= coba->data; 01151 01152 v1[0]= v2[0]= x1; 01153 v1[1]= y1; 01154 v2[1]= y1+sizey; 01155 01156 glBegin(GL_QUAD_STRIP); 01157 01158 glColor4fv( &cbd->r ); 01159 glVertex2fv(v1); glVertex2fv(v2); 01160 01161 for( a = 1; a <= sizex; a++ ) { 01162 pos = ((float)a) / (sizex-1); 01163 do_colorband( coba, pos, colf ); 01164 if (but->block->color_profile != BLI_PR_NONE) 01165 linearrgb_to_srgb_v3_v3(colf, colf); 01166 01167 v1[0]=v2[0]= x1 + a; 01168 01169 glColor4fv( colf ); 01170 glVertex2fv(v1); glVertex2fv(v2); 01171 } 01172 01173 glEnd(); 01174 glShadeModel(GL_FLAT); 01175 glDisable(GL_BLEND); 01176 01177 /* outline */ 01178 glColor4f(0.0, 0.0, 0.0, 1.0); 01179 fdrawbox(x1, y1, x1+sizex, y1+sizey); 01180 01181 /* help lines */ 01182 v1[0]= v2[0]=v3[0]= x1; 01183 v1[1]= y1; 01184 v1a[1]= y1+0.25f*sizey; 01185 v2[1]= y1+0.5f*sizey; 01186 v2a[1]= y1+0.75f*sizey; 01187 v3[1]= y1+sizey; 01188 01189 01190 cbd= coba->data; 01191 glBegin(GL_LINES); 01192 for(a=0; a<coba->tot; a++, cbd++) { 01193 v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex; 01194 01195 if(a==coba->cur) { 01196 glColor3ub(0, 0, 0); 01197 glVertex2fv(v1); 01198 glVertex2fv(v3); 01199 glEnd(); 01200 01201 setlinestyle(2); 01202 glBegin(GL_LINES); 01203 glColor3ub(255, 255, 255); 01204 glVertex2fv(v1); 01205 glVertex2fv(v3); 01206 glEnd(); 01207 setlinestyle(0); 01208 glBegin(GL_LINES); 01209 01210 /* glColor3ub(0, 0, 0); 01211 glVertex2fv(v1); 01212 glVertex2fv(v1a); 01213 glColor3ub(255, 255, 255); 01214 glVertex2fv(v1a); 01215 glVertex2fv(v2); 01216 glColor3ub(0, 0, 0); 01217 glVertex2fv(v2); 01218 glVertex2fv(v2a); 01219 glColor3ub(255, 255, 255); 01220 glVertex2fv(v2a); 01221 glVertex2fv(v3); 01222 */ 01223 } 01224 else { 01225 glColor3ub(0, 0, 0); 01226 glVertex2fv(v1); 01227 glVertex2fv(v2); 01228 01229 glColor3ub(255, 255, 255); 01230 glVertex2fv(v2); 01231 glVertex2fv(v3); 01232 } 01233 } 01234 glEnd(); 01235 01236 } 01237 01238 void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect) 01239 { 01240 static GLuint displist=0; 01241 int a, old[8]; 01242 GLfloat diff[4], diffn[4]={1.0f, 1.0f, 1.0f, 1.0f}; 01243 float vec0[4]={0.0f, 0.0f, 0.0f, 0.0f}; 01244 float dir[4], size; 01245 01246 /* store stuff */ 01247 glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff); 01248 01249 /* backdrop */ 01250 glColor3ubv((unsigned char*)wcol->inner); 01251 uiSetRoundBox(15); 01252 uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); 01253 01254 /* sphere color */ 01255 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn); 01256 glCullFace(GL_BACK); glEnable(GL_CULL_FACE); 01257 01258 /* disable blender light */ 01259 for(a=0; a<8; a++) { 01260 old[a]= glIsEnabled(GL_LIGHT0+a); 01261 glDisable(GL_LIGHT0+a); 01262 } 01263 01264 /* own light */ 01265 glEnable(GL_LIGHT7); 01266 glEnable(GL_LIGHTING); 01267 01268 ui_get_but_vectorf(but, dir); 01269 01270 dir[3]= 0.0f; /* glLight needs 4 args, 0.0 is sun */ 01271 glLightfv(GL_LIGHT7, GL_POSITION, dir); 01272 glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn); 01273 glLightfv(GL_LIGHT7, GL_SPECULAR, vec0); 01274 glLightf(GL_LIGHT7, GL_CONSTANT_ATTENUATION, 1.0f); 01275 glLightf(GL_LIGHT7, GL_LINEAR_ATTENUATION, 0.0f); 01276 01277 /* transform to button */ 01278 glPushMatrix(); 01279 glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f); 01280 01281 if( rect->xmax-rect->xmin < rect->ymax-rect->ymin) 01282 size= (rect->xmax-rect->xmin)/200.f; 01283 else 01284 size= (rect->ymax-rect->ymin)/200.f; 01285 01286 glScalef(size, size, size); 01287 01288 if(displist==0) { 01289 GLUquadricObj *qobj; 01290 01291 displist= glGenLists(1); 01292 glNewList(displist, GL_COMPILE_AND_EXECUTE); 01293 01294 qobj= gluNewQuadric(); 01295 gluQuadricDrawStyle(qobj, GLU_FILL); 01296 glShadeModel(GL_SMOOTH); 01297 gluSphere( qobj, 100.0, 32, 24); 01298 glShadeModel(GL_FLAT); 01299 gluDeleteQuadric(qobj); 01300 01301 glEndList(); 01302 } 01303 else glCallList(displist); 01304 01305 /* restore */ 01306 glDisable(GL_LIGHTING); 01307 glDisable(GL_CULL_FACE); 01308 glMaterialfv(GL_FRONT, GL_DIFFUSE, diff); 01309 glDisable(GL_LIGHT7); 01310 01311 /* AA circle */ 01312 glEnable(GL_BLEND); 01313 glEnable(GL_LINE_SMOOTH ); 01314 glColor3ubv((unsigned char*)wcol->inner); 01315 glutil_draw_lined_arc(0.0f, M_PI*2.0, 100.0f, 32); 01316 glDisable(GL_BLEND); 01317 glDisable(GL_LINE_SMOOTH ); 01318 01319 /* matrix after circle */ 01320 glPopMatrix(); 01321 01322 /* enable blender light */ 01323 for(a=0; a<8; a++) { 01324 if(old[a]) 01325 glEnable(GL_LIGHT0+a); 01326 } 01327 } 01328 01329 static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step) 01330 { 01331 float dx, dy, fx, fy; 01332 01333 glBegin(GL_LINES); 01334 dx= step*zoomx; 01335 fx= rect->xmin + zoomx*(-offsx); 01336 if(fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin)); 01337 while(fx < rect->xmax) { 01338 glVertex2f(fx, rect->ymin); 01339 glVertex2f(fx, rect->ymax); 01340 fx+= dx; 01341 } 01342 01343 dy= step*zoomy; 01344 fy= rect->ymin + zoomy*(-offsy); 01345 if(fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin)); 01346 while(fy < rect->ymax) { 01347 glVertex2f(rect->xmin, fy); 01348 glVertex2f(rect->xmax, fy); 01349 fy+= dy; 01350 } 01351 glEnd(); 01352 01353 } 01354 01355 static void glColor3ubvShade(unsigned char *col, int shade) 01356 { 01357 glColor3ub(col[0]-shade>0?col[0]-shade:0, 01358 col[1]-shade>0?col[1]-shade:0, 01359 col[2]-shade>0?col[2]-shade:0); 01360 } 01361 01362 void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect) 01363 { 01364 CurveMapping *cumap; 01365 CurveMap *cuma; 01366 CurveMapPoint *cmp; 01367 float fx, fy, fac[2], zoomx, zoomy, offsx, offsy; 01368 GLint scissor[4]; 01369 rcti scissor_new; 01370 int a; 01371 01372 cumap= (CurveMapping *)(but->editcumap? but->editcumap: but->poin); 01373 cuma= cumap->cm+cumap->cur; 01374 01375 /* need scissor test, curve can draw outside of boundary */ 01376 glGetIntegerv(GL_VIEWPORT, scissor); 01377 scissor_new.xmin= ar->winrct.xmin + rect->xmin; 01378 scissor_new.ymin= ar->winrct.ymin + rect->ymin; 01379 scissor_new.xmax= ar->winrct.xmin + rect->xmax; 01380 scissor_new.ymax= ar->winrct.ymin + rect->ymax; 01381 BLI_isect_rcti(&scissor_new, &ar->winrct, &scissor_new); 01382 glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax-scissor_new.xmin, scissor_new.ymax-scissor_new.ymin); 01383 01384 /* calculate offset and zoom */ 01385 zoomx= (rect->xmax-rect->xmin-2.0f*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin); 01386 zoomy= (rect->ymax-rect->ymin-2.0f*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin); 01387 offsx= cumap->curr.xmin-but->aspect/zoomx; 01388 offsy= cumap->curr.ymin-but->aspect/zoomy; 01389 01390 /* backdrop */ 01391 if(cumap->flag & CUMA_DO_CLIP) { 01392 glColor3ubvShade((unsigned char *)wcol->inner, -20); 01393 glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); 01394 glColor3ubv((unsigned char*)wcol->inner); 01395 glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx), 01396 rect->ymin + zoomy*(cumap->clipr.ymin-offsy), 01397 rect->xmin + zoomx*(cumap->clipr.xmax-offsx), 01398 rect->ymin + zoomy*(cumap->clipr.ymax-offsy)); 01399 } 01400 else { 01401 glColor3ubv((unsigned char*)wcol->inner); 01402 glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); 01403 } 01404 01405 /* grid, every .25 step */ 01406 glColor3ubvShade((unsigned char *)wcol->inner, -16); 01407 ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f); 01408 /* grid, every 1.0 step */ 01409 glColor3ubvShade((unsigned char *)wcol->inner, -24); 01410 ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f); 01411 /* axes */ 01412 glColor3ubvShade((unsigned char *)wcol->inner, -50); 01413 glBegin(GL_LINES); 01414 glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy)); 01415 glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy)); 01416 glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymin); 01417 glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymax); 01418 glEnd(); 01419 01420 /* magic trigger for curve backgrounds */ 01421 if (but->a1 != -1) { 01422 if (but->a1 == UI_GRAD_H) { 01423 rcti grid; 01424 float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */ 01425 01426 grid.xmin = rect->xmin + zoomx*(-offsx); 01427 grid.xmax = rect->xmax + zoomx*(-offsx); 01428 grid.ymin = rect->ymin + zoomy*(-offsy); 01429 grid.ymax = rect->ymax + zoomy*(-offsy); 01430 01431 glEnable(GL_BLEND); 01432 ui_draw_gradient(&grid, col, UI_GRAD_H, 0.5f); 01433 glDisable(GL_BLEND); 01434 } 01435 } 01436 01437 01438 /* cfra option */ 01439 /* XXX 2.48 01440 if(cumap->flag & CUMA_DRAW_CFRA) { 01441 glColor3ub(0x60, 0xc0, 0x40); 01442 glBegin(GL_LINES); 01443 glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymin); 01444 glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymax); 01445 glEnd(); 01446 }*/ 01447 /* sample option */ 01448 /* XXX 2.48 01449 * if(cumap->flag & CUMA_DRAW_SAMPLE) { 01450 if(cumap->cur==3) { 01451 float lum= cumap->sample[0]*0.35f + cumap->sample[1]*0.45f + cumap->sample[2]*0.2f; 01452 glColor3ub(240, 240, 240); 01453 01454 glBegin(GL_LINES); 01455 glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymin); 01456 glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymax); 01457 glEnd(); 01458 } 01459 else { 01460 if(cumap->cur==0) 01461 glColor3ub(240, 100, 100); 01462 else if(cumap->cur==1) 01463 glColor3ub(100, 240, 100); 01464 else 01465 glColor3ub(100, 100, 240); 01466 01467 glBegin(GL_LINES); 01468 glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymin); 01469 glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymax); 01470 glEnd(); 01471 } 01472 }*/ 01473 01474 /* the curve */ 01475 glColor3ubv((unsigned char*)wcol->item); 01476 glEnable(GL_LINE_SMOOTH); 01477 glEnable(GL_BLEND); 01478 glBegin(GL_LINE_STRIP); 01479 01480 if(cuma->table==NULL) 01481 curvemapping_changed(cumap, 0); /* 0 = no remove doubles */ 01482 cmp= cuma->table; 01483 01484 /* first point */ 01485 if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) 01486 glVertex2f(rect->xmin, rect->ymin + zoomy*(cmp[0].y-offsy)); 01487 else { 01488 fx= rect->xmin + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]); 01489 fy= rect->ymin + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]); 01490 glVertex2f(fx, fy); 01491 } 01492 for(a=0; a<=CM_TABLE; a++) { 01493 fx= rect->xmin + zoomx*(cmp[a].x-offsx); 01494 fy= rect->ymin + zoomy*(cmp[a].y-offsy); 01495 glVertex2f(fx, fy); 01496 } 01497 /* last point */ 01498 if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) 01499 glVertex2f(rect->xmax, rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy)); 01500 else { 01501 fx= rect->xmin + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]); 01502 fy= rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]); 01503 glVertex2f(fx, fy); 01504 } 01505 glEnd(); 01506 glDisable(GL_LINE_SMOOTH); 01507 glDisable(GL_BLEND); 01508 01509 /* the points, use aspect to make them visible on edges */ 01510 cmp= cuma->curve; 01511 glPointSize(3.0f); 01512 bglBegin(GL_POINTS); 01513 for(a=0; a<cuma->totpoint; a++) { 01514 if(cmp[a].flag & SELECT) 01515 UI_ThemeColor(TH_TEXT_HI); 01516 else 01517 UI_ThemeColor(TH_TEXT); 01518 fac[0]= rect->xmin + zoomx*(cmp[a].x-offsx); 01519 fac[1]= rect->ymin + zoomy*(cmp[a].y-offsy); 01520 bglVertex2fv(fac); 01521 } 01522 bglEnd(); 01523 glPointSize(1.0f); 01524 01525 /* restore scissortest */ 01526 glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); 01527 01528 /* outline */ 01529 glColor3ubv((unsigned char*)wcol->outline); 01530 fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax); 01531 } 01532 01533 01534 /* ****************************************************** */ 01535 01536 01537 static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha) 01538 { 01539 glEnable(GL_BLEND); 01540 glShadeModel(GL_SMOOTH); 01541 01542 /* right quad */ 01543 glBegin(GL_POLYGON); 01544 glColor4ub(0, 0, 0, alpha); 01545 glVertex2f(maxx, miny); 01546 glVertex2f(maxx, maxy-0.3f*shadsize); 01547 glColor4ub(0, 0, 0, 0); 01548 glVertex2f(maxx+shadsize, maxy-0.75f*shadsize); 01549 glVertex2f(maxx+shadsize, miny); 01550 glEnd(); 01551 01552 /* corner shape */ 01553 glBegin(GL_POLYGON); 01554 glColor4ub(0, 0, 0, alpha); 01555 glVertex2f(maxx, miny); 01556 glColor4ub(0, 0, 0, 0); 01557 glVertex2f(maxx+shadsize, miny); 01558 glVertex2f(maxx+0.7f*shadsize, miny-0.7f*shadsize); 01559 glVertex2f(maxx, miny-shadsize); 01560 glEnd(); 01561 01562 /* bottom quad */ 01563 glBegin(GL_POLYGON); 01564 glColor4ub(0, 0, 0, alpha); 01565 glVertex2f(minx+0.3f*shadsize, miny); 01566 glVertex2f(maxx, miny); 01567 glColor4ub(0, 0, 0, 0); 01568 glVertex2f(maxx, miny-shadsize); 01569 glVertex2f(minx+0.5f*shadsize, miny-shadsize); 01570 glEnd(); 01571 01572 glDisable(GL_BLEND); 01573 glShadeModel(GL_FLAT); 01574 } 01575 01576 void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) 01577 { 01578 /* accumulated outline boxes to make shade not linear, is more pleasant */ 01579 ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*alpha)>>8); 01580 ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*alpha)>>8); 01581 ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*alpha)>>8); 01582 01583 } 01584 01585 01586 void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select)) 01587 { 01588 int i; 01589 float rad; 01590 float a; 01591 char alpha= 2; 01592 01593 glEnable(GL_BLEND); 01594 01595 if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f) 01596 rad= (rct->ymax-rct->ymin-10.0f)/2.0f; 01597 else 01598 rad= radius; 01599 01600 i= 12; 01601 #if 0 01602 if(select) { 01603 a= i*aspect; /* same as below */ 01604 } 01605 else 01606 #endif 01607 { 01608 a= i*aspect; 01609 01610 } 01611 01612 for(; i--; a-=aspect) { 01613 /* alpha ranges from 2 to 20 or so */ 01614 glColor4ub(0, 0, 0, alpha); 01615 alpha+= 2; 01616 01617 uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax-10.0f + a, rad+a); 01618 } 01619 01620 /* outline emphasis */ 01621 glEnable( GL_LINE_SMOOTH ); 01622 glColor4ub(0, 0, 0, 100); 01623 uiDrawBox(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius+0.5f); 01624 glDisable( GL_LINE_SMOOTH ); 01625 01626 glDisable(GL_BLEND); 01627 } 01628