Changeset 434 for trunk/gui/vizservers/nanovis
- Timestamp:
- May 9, 2006, 2:55:08 PM (18 years ago)
- Location:
- trunk/gui/vizservers/nanovis
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/nanovis/Color.cpp
r379 r434 18 18 19 19 #include "Color.h" 20 #include "define.h" 20 21 21 Color::Color() {22 Color::Color() { 22 23 R=G=B=0.0; 23 24 next=0; 24 25 } 25 26 26 Color::Color(double r, double g, double b) {27 Color::Color(double r, double g, double b) { 27 28 R=r; 28 29 G=g; 29 30 B=b; 30 31 next=0; 32 } 33 34 Color::Color(const Color& c) 35 : R(c.R), G(c.G), B(c.B), next(c.next) 36 { 37 } 38 39 Color& 40 Color::operator=(const Color& c) 41 { 42 R = c.R; 43 G = c.G; 44 B = c.B; 45 next = c.next; 46 return *this; 31 47 } 32 48 -
trunk/gui/vizservers/nanovis/Color.h
r379 r434 34 34 Color(); 35 35 Color(double r, double g, double b); 36 Color(const Color& c); 37 Color& operator=(const Color& c); 38 ~Color(); 36 39 37 40 void LimitColors(); //Limits the color to be in range of 0.0 and 1.0 … … 39 42 friend Color operator*(double k, Color &other); 40 43 Color operator+(Color &other); 41 ~Color();42 float r, g, b, a;43 44 }; 44 45 -
trunk/gui/vizservers/nanovis/Makefile
r431 r434 15 15 NANOSCALESRC = ./nanoscale 16 16 17 LIB_NANOVIS = -ltcl8. 4-L/opt/render/lib -lGL -lglut -lglui -lGLEW -lCg -lCgGL -pthread -lstdc++17 LIB_NANOVIS = -ltcl8.3 -L/opt/render/lib -lGL -lglut -lglui -lGLEW -lCg -lCgGL -pthread -lstdc++ 18 18 LIB_CLIENT = -L/opt/render/lib -lGL -lglut -pthread -lstdc++ 19 INCLUDES = -I../ src2/core -I/opt/render/include -I/autohome/u76/qiaow/Cg/usr/include19 INCLUDES = -I../../src2/core -I/opt/render/include -I/autohome/u76/qiaow/Cg/usr/include 20 20 CFLAG = -g -c $(INCLUDES) 21 21 … … 26 26 27 27 nanovis: $(OBJ_NANOVIS) 28 gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../ src2/core/*.o28 gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../../src2/core/*.o 29 29 30 30 ColorGradient.o: Color.o $(TFSRC)/ColorGradient.cpp -
trunk/gui/vizservers/nanovis/Volume.cpp
r431 r434 27 27 n_components(n), 28 28 enabled(true), 29 n_slice(256), //defualt value 30 specular(6.), //defualt value 31 diffuse(3.), //defualt value 32 opacity_scale(10.) //defualt value 29 n_slice(256), // default value 30 specular(6.), // default value 31 diffuse(3.), // default value 32 opacity_scale(10.), // default value 33 data_enabled(true), // default value 34 outline_enabled(true), // default value 35 outline_color(1.,1.,1.) // default value 33 36 { 34 37 … … 113 116 void Volume::set_diffuse(float d) { diffuse = d; } 114 117 void Volume::set_opacity_scale(float s) { opacity_scale = s; } 118 119 void Volume::enable_data() { data_enabled = true; } 120 void Volume::disable_data() { data_enabled = false; } 121 bool Volume::data_is_enabled() { return data_enabled; } 122 123 void Volume::enable_outline() { outline_enabled = true; } 124 void Volume::disable_outline() { outline_enabled = false; } 125 bool Volume::outline_is_enabled() { return outline_enabled; } 126 void Volume::set_outline_color(float *rgb) { 127 outline_color = Color(rgb[0],rgb[1],rgb[2]); 128 } 129 void Volume::get_outline_color(float *rgb) { 130 outline_color.GetRGB(rgb); 131 } -
trunk/gui/vizservers/nanovis/Volume.h
r431 r434 20 20 21 21 #include "define.h" 22 #include "Color.h" 22 23 #include "Texture3D.h" 23 24 #include "Vector3.h" … … 48 49 float opacity_scale; //The scale multiplied to the opacity assigned by the transfer function. 49 50 //Rule of thumb: higher opacity_scale the object is to appear like plastic 51 52 bool data_enabled; // show/hide cloud of volume data 53 54 bool outline_enabled; // show/hide outline around volume 55 Color outline_color; // color for outline around volume 50 56 51 57 public: … … 102 108 void set_opacity_scale(float s); 103 109 110 void enable_data(); 111 void disable_data(); 112 bool data_is_enabled(); 113 114 void enable_outline(); 115 void disable_outline(); 116 bool outline_is_enabled(); 117 void set_outline_color(float* rgb); 118 void get_outline_color(float* rgb); 104 119 }; 105 120 -
trunk/gui/vizservers/nanovis/VolumeRenderer.cpp
r432 r434 157 157 158 158 //draw volume bounding box with translation (the correct location in space) 159 draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1, 0.8, 0.1, 0.1, 1.5); 159 if (volume[i]->outline_is_enabled()) { 160 float olcolor[3]; 161 volume[i]->get_outline_color(olcolor); 162 draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1, 163 (double)olcolor[0], (double)olcolor[1], (double)olcolor[2], 164 1.5); 165 } 160 166 glPopMatrix(); 161 167 … … 167 173 //compute actual rendering slices 168 174 float z_step = fabs(zNear-zFar)/n_slices; 169 int n_actual_slices = (int)(fabs(zNear-zFar)/z_step + 1); 170 171 //if no cloud 172 //n_actual_slices = 0; 173 175 int n_actual_slices; 176 177 if (volume[i]->data_is_enabled()) { 178 n_actual_slices = (int)(fabs(zNear-zFar)/z_step + 1); 179 polys[cur_vol] = new ConvexPolygon*[n_actual_slices]; 180 } else { 181 n_actual_slices = 0; 182 polys[cur_vol] = NULL; 183 } 174 184 actual_slices[cur_vol] = n_actual_slices; 175 polys[cur_vol] = new ConvexPolygon*[n_actual_slices];176 177 //if no cloud178 //polys[cur_vol] = NULL;179 180 float slice_z;181 185 182 186 Vector4 vert1 = (Vector4(-10, -10, -0.5, 1)); … … 268 272 269 273 //transform slices and store them 274 float slice_z; 270 275 for (int i=0; i<n_actual_slices; i++){ 271 276 slice_z = zFar + i * z_step; //back to front -
trunk/gui/vizservers/nanovis/config.h
r431 r434 16 16 17 17 #define NV40 //Uncomment if using 6 series card. By default we assume older card the 5xxx series 18 //#define XINETD //enable render server18 #define XINETD //enable render server 19 19 //#define EVENTLOG //enable event logging 20 20 //#define DO_RLE //do run length compression -
trunk/gui/vizservers/nanovis/define.h
r406 r434 54 54 } 55 55 56 // use this to send debug messages back to the client 57 void debug(char *message); 58 void debug(char *message, double v1); 59 void debug(char *message, double v1, double v2); 60 void debug(char *message, double v1, double v2, double v3); 56 61 57 62 #endif -
trunk/gui/vizservers/nanovis/nanovis.cpp
r432 r434 41 41 Camera* cam; 42 42 43 bool volume_mode = false; //if true nanovis renders volumes in 3D, if not renders 2D plane 43 //if true nanovis renders volumes in 3D, if not renders 2D plane 44 bool volume_mode = true; 44 45 45 46 // color table for built-in transfer function editor … … 120 121 static int CutplaneCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 121 122 static int ClearCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 122 static int Screen ResizeCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]));123 static int ScreenCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 123 124 static int TransferFunctionNewCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 124 125 static int TransferFunctionUpdateCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 126 static int VolumeCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 125 127 static int VolumeNewCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 126 128 static int VolumeLinkCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 127 129 static int VolumeMoveCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 128 130 static int VolumeEnableCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 129 static int OutlineCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]));130 131 static int RefreshCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 131 static int Switch2D3DCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]));132 132 static int PlaneNewCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 133 133 static int PlaneLinkCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 134 134 static int PlaneEnableCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 135 135 136 static int DecodeAxis _ANSI_ARGS_((Tcl_Interp *interp, char *str, int *valPtr)); 136 static int GetAxis _ANSI_ARGS_((Tcl_Interp *interp, char *str, int *valPtr)); 137 static int GetColor _ANSI_ARGS_((Tcl_Interp *interp, char *str, float *rgbPtr)); 137 138 138 139 /* … … 262 263 263 264 int axis; 264 if ( DecodeAxis(interp, (char*)argv[3], &axis) != TCL_OK) {265 if (GetAxis(interp, argv[3], &axis) != TCL_OK) { 265 266 return TCL_ERROR; 266 267 } … … 305 306 return TCL_ERROR; 306 307 } 308 // keep this just inside the volume so it doesn't disappear 309 if (relval < 0.01) { relval = 0.01; } 310 if (relval > 0.99) { relval = 0.99; } 307 311 308 312 int axis; 309 if ( DecodeAxis(interp, (char*)argv[3], &axis) != TCL_OK) {313 if (GetAxis(interp, argv[3], &axis) != TCL_OK) { 310 314 return TCL_ERROR; 311 315 } … … 337 341 } 338 342 339 /*340 * ----------------------------------------------------------------------341 * FUNCTION: DecodeAxis()342 *343 * Used internally to decode an axis value from a string ("x", "y",344 * or "z") to its index (0, 1, or 2). Returns TCL_OK if successful,345 * along with a value in valPtr. Otherwise, it returns TCL_ERROR346 * and an error message in the interpreter.347 * ----------------------------------------------------------------------348 */349 static int350 DecodeAxis(Tcl_Interp *interp, char *str, int *valPtr)351 {352 if (strcmp(str,"x") == 0) {353 *valPtr = 0;354 return TCL_OK;355 }356 else if (strcmp(str,"y") == 0) {357 *valPtr = 1;358 return TCL_OK;359 }360 else if (strcmp(str,"z") == 0) {361 *valPtr = 2;362 return TCL_OK;363 }364 Tcl_AppendResult(interp, "bad axis \"", str,365 "\": should be x, y, or z", (char*)NULL);366 return TCL_ERROR;367 }368 369 343 void resize_offscreen_buffer(int w, int h); 370 344 371 345 //change screen size 372 346 static int 373 Screen ResizeCmd(ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])347 ScreenCmd(ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]) 374 348 { 375 349 … … 470 444 live_obj_y = y; 471 445 live_obj_z = z; 446 } 447 448 /* 449 * ---------------------------------------------------------------------- 450 * CLIENT COMMAND: 451 * volume outline state on|off ?<volumeId> ...? 452 * volume outline color on|off ?<volumeId> ...? 453 * volume data state on|off ?<volumeId> ...? 454 * 455 * Clients send these commands to manipulate the volumes. 456 * ---------------------------------------------------------------------- 457 */ 458 static int 459 VolumeCmd(ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]) 460 { 461 if (argc < 2) { 462 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 463 " option arg arg...\"", (char*)NULL); 464 return TCL_ERROR; 465 } 466 467 char c = *argv[1]; 468 if (c == 'o' && strcmp(argv[1],"outline") == 0) { 469 if (argc < 3) { 470 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 471 argv[1], " option ?arg arg...?\"", (char*)NULL); 472 return TCL_ERROR; 473 } 474 c = *argv[2]; 475 if (c == 's' && strcmp(argv[2],"state") == 0) { 476 if (argc < 3) { 477 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 478 argv[1], " state on|off ?volume ...? \"", (char*)NULL); 479 return TCL_ERROR; 480 } 481 482 int state; 483 if (Tcl_GetBoolean(interp, argv[3], &state) != TCL_OK) { 484 return TCL_ERROR; 485 } 486 487 int ivol; 488 if (argc < 5) { 489 for (ivol=0; ivol < n_volumes; ivol++) { 490 if (state) { 491 volume[ivol]->enable_outline(); 492 } else { 493 volume[ivol]->disable_outline(); 494 } 495 } 496 } else { 497 for (int n=4; n < argc; n++) { 498 if (Tcl_GetInt(interp, argv[n], &ivol) != TCL_OK) { 499 return TCL_ERROR; 500 } 501 if (ivol < 0 || ivol > n_volumes) { 502 Tcl_AppendResult(interp, "bad volume index \"", argv[n], 503 "\": out of range", (char*)NULL); 504 return TCL_ERROR; 505 } 506 if (state) { 507 volume[ivol]->enable_outline(); 508 } else { 509 volume[ivol]->disable_outline(); 510 } 511 } 512 } 513 return TCL_OK; 514 } 515 else if (c == 'c' && strcmp(argv[2],"color") == 0) { 516 if (argc < 3) { 517 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 518 argv[1], " color {R G B} ?volume ...? \"", (char*)NULL); 519 return TCL_ERROR; 520 } 521 522 float rgb[3]; 523 if (GetColor(interp, argv[3], rgb) != TCL_OK) { 524 return TCL_ERROR; 525 } 526 527 int ivol; 528 if (argc < 5) { 529 for (ivol=0; ivol < n_volumes; ivol++) { 530 volume[ivol]->set_outline_color(rgb); 531 } 532 } else { 533 for (int n=4; n < argc; n++) { 534 if (Tcl_GetInt(interp, argv[n], &ivol) != TCL_OK) { 535 return TCL_ERROR; 536 } 537 if (ivol < 0 || ivol > n_volumes) { 538 Tcl_AppendResult(interp, "bad volume index \"", argv[n], 539 "\": out of range", (char*)NULL); 540 return TCL_ERROR; 541 } 542 volume[ivol]->set_outline_color(rgb); 543 } 544 } 545 return TCL_OK; 546 } 547 548 Tcl_AppendResult(interp, "bad option \"", argv[2], 549 "\": should be color or state", (char*)NULL); 550 return TCL_ERROR; 551 } 552 else if (c == 's' && strcmp(argv[1],"state") == 0) { 553 if (argc < 3) { 554 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 555 " state on|off ?volume ...?\"", (char*)NULL); 556 return TCL_ERROR; 557 } 558 559 int state; 560 if (Tcl_GetBoolean(interp, argv[2], &state) != TCL_OK) { 561 return TCL_ERROR; 562 } 563 564 int ivol; 565 for (int n=3; n < argc; n++) { 566 if (Tcl_GetInt(interp, argv[n], &ivol) != TCL_OK) { 567 return TCL_ERROR; 568 } 569 if (state) { 570 volume[ivol]->enable_data(); 571 } else { 572 volume[ivol]->disable_data(); 573 } 574 } 575 return TCL_OK; 576 } 577 578 Tcl_AppendResult(interp, "bad option \"", argv[1], 579 "\": should be state", (char*)NULL); 580 return TCL_ERROR; 472 581 } 473 582 … … 626 735 } 627 736 628 629 //Switch: 630 //arg[1] = 0 : 3D rendering 631 //arg[1] !=0 : 2D rendering 737 /* 738 * ---------------------------------------------------------------------- 739 * FUNCTION: GetAxis() 740 * 741 * Used internally to decode an axis value from a string ("x", "y", 742 * or "z") to its index (0, 1, or 2). Returns TCL_OK if successful, 743 * along with a value in valPtr. Otherwise, it returns TCL_ERROR 744 * and an error message in the interpreter. 745 * ---------------------------------------------------------------------- 746 */ 632 747 static int 633 Switch2D3DCmd(ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])748 GetAxis(Tcl_Interp *interp, char *str, int *valPtr) 634 749 { 635 fprintf(stderr, "switch 2D 3D rendering modes cmd\n"); 636 637 double mode; 638 639 if (argc != 2) { 640 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 641 " mode\"", (char*)NULL); 750 if (strcmp(str,"x") == 0) { 751 *valPtr = 0; 752 return TCL_OK; 753 } 754 else if (strcmp(str,"y") == 0) { 755 *valPtr = 1; 756 return TCL_OK; 757 } 758 else if (strcmp(str,"z") == 0) { 759 *valPtr = 2; 760 return TCL_OK; 761 } 762 Tcl_AppendResult(interp, "bad axis \"", str, 763 "\": should be x, y, or z", (char*)NULL); 642 764 return TCL_ERROR; 643 } 644 if (Tcl_GetDouble(interp, argv[1], &mode) != TCL_OK) { 645 return TCL_ERROR; 646 } 647 648 if(mode==0) 649 volume_mode = true; 650 else 651 volume_mode = false; 652 653 return TCL_OK; 765 } 766 767 /* 768 * ---------------------------------------------------------------------- 769 * FUNCTION: GetColor() 770 * 771 * Used internally to decode a color value from a string ("R G B") 772 * as a list of three numbers 0-1. Returns TCL_OK if successful, 773 * along with RGB values in valPtr. Otherwise, it returns TCL_ERROR 774 * and an error message in the interpreter. 775 * ---------------------------------------------------------------------- 776 */ 777 static int 778 GetColor(Tcl_Interp *interp, char *str, float *rgbPtr) 779 { 780 int rgbc; 781 char **rgbv; 782 if (Tcl_SplitList(interp, str, &rgbc, &rgbv) != TCL_OK) { 783 return TCL_ERROR; 784 } 785 if (rgbc != 3) { 786 Tcl_AppendResult(interp, "bad color \"", str, 787 "\": should be {R G B} as double values 0-1", (char*)NULL); 788 return TCL_ERROR; 789 } 790 791 double rval, gval, bval; 792 if (Tcl_GetDouble(interp, rgbv[0], &rval) != TCL_OK) { 793 Tcl_Free((char*)rgbv); 794 return TCL_ERROR; 795 } 796 if (Tcl_GetDouble(interp, rgbv[1], &gval) != TCL_OK) { 797 Tcl_Free((char*)rgbv); 798 return TCL_ERROR; 799 } 800 if (Tcl_GetDouble(interp, rgbv[2], &bval) != TCL_OK) { 801 Tcl_Free((char*)rgbv); 802 return TCL_ERROR; 803 } 804 Tcl_Free((char*)rgbv); 805 806 rgbPtr[0] = (float)rval; 807 rgbPtr[1] = (float)gval; 808 rgbPtr[2] = (float)bval; 809 810 return TCL_OK; 811 } 812 813 /* 814 * ---------------------------------------------------------------------- 815 * USAGE: debug("string", ...) 816 * 817 * Use this anywhere within the package to send a debug message 818 * back to the client. The string can have % fields as used by 819 * the printf() package. Any remaining arguments are treated as 820 * field substitutions on that. 821 * ---------------------------------------------------------------------- 822 */ 823 void 824 debug(char *str) 825 { 826 write(0, str, strlen(str)); 827 } 828 829 void 830 debug(char *str, double v1) 831 { 832 char buffer[512]; 833 sprintf(buffer, str, v1); 834 write(0, buffer, strlen(buffer)); 835 } 836 837 void 838 debug(char *str, double v1, double v2) 839 { 840 char buffer[512]; 841 sprintf(buffer, str, v1, v2); 842 write(0, buffer, strlen(buffer)); 843 } 844 845 void 846 debug(char *str, double v1, double v2, double v3) 847 { 848 char buffer[512]; 849 sprintf(buffer, str, v1, v2, v3); 850 write(0, buffer, strlen(buffer)); 654 851 } 655 852 … … 742 939 return TCL_OK; 743 940 } 744 745 941 746 942 … … 1201 1397 volume[index] = new Volume(0.f, 0.f, 0.f, width, height, depth, 1., n_component, data); 1202 1398 assert(volume[index]!=0); 1399 1400 if (n_volumes <= index) { 1401 n_volumes = index+1; 1402 } 1203 1403 } 1204 1404 … … 1301 1501 if (screen_buffer) { 1302 1502 delete[] screen_buffer; 1303 screen_buffer = 0;1503 screen_buffer = NULL; 1304 1504 } 1305 1505 screen_buffer = new unsigned char[4*win_width*win_height]; 1306 assert(screen_buffer !=0);1506 assert(screen_buffer != NULL); 1307 1507 1308 1508 //delete the current render buffer resources … … 1475 1675 if (screen_buffer) { 1476 1676 delete[] screen_buffer; 1477 screen_buffer = 0;1677 screen_buffer = NULL; 1478 1678 } 1479 1679 screen_buffer = new unsigned char[4*win_width*win_height]; 1480 assert(screen_buffer !=0);1680 assert(screen_buffer != NULL); 1481 1681 1482 1682 //create the camera with default setting … … 1563 1763 1564 1764 void initTcl(){ 1565 interp = Tcl_CreateInterp(); 1566 Tcl_MakeSafe(interp); 1567 1568 //set camera (viewing) 1569 Tcl_CreateCommand(interp, "camera", CameraCmd, (ClientData)0, (Tcl_CmdDeleteProc*)NULL); 1570 1571 Tcl_CreateCommand(interp, "cutplane", CutplaneCmd, (ClientData)0, (Tcl_CmdDeleteProc*)NULL); 1572 1573 //resize the width and height of render screen 1574 Tcl_CreateCommand(interp, "screen", ScreenResizeCmd, (ClientData)0, (Tcl_CmdDeleteProc*)NULL); 1765 interp = Tcl_CreateInterp(); 1766 Tcl_MakeSafe(interp); 1767 1768 // manipulate the viewpoint 1769 Tcl_CreateCommand(interp, "camera", CameraCmd, 1770 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 1771 1772 // turn on/off cut planes in x/y/z directions 1773 Tcl_CreateCommand(interp, "cutplane", CutplaneCmd, 1774 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 1775 1776 // change the size of the screen (size of picture generated) 1777 Tcl_CreateCommand(interp, "screen", ScreenCmd, 1778 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 1779 1780 // manipulate volume data 1781 Tcl_CreateCommand(interp, "volume", VolumeCmd, 1782 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 1575 1783 1576 1784 //create new transfer function … … 1578 1786 //update an existing transfer function 1579 1787 Tcl_CreateCommand(interp, "tf_update", TransferFunctionUpdateCmd, (ClientData)0, (Tcl_CmdDeleteProc*)NULL); 1788 1580 1789 1581 1790 //create new volume … … 1606 1815 glReadPixels(0, 0, win_width, win_height, GL_RGB, GL_UNSIGNED_BYTE, screen_buffer); 1607 1816 assert(glGetError()==0); 1608 1609 /*1610 //debug: check from the back of screen_buffer to see how far ReadPixel went1611 fprintf(stderr, "%d %d:", win_width, win_height);1612 for(int i=5*win_width*win_height-1; i>=0; i--){1613 if(screen_buffer[i] != 253){1614 fprintf(stderr, "%d\n", i);1615 i=0;1616 }1617 }1618 */1619 1620 /*1621 for(int i=0; i<win_width*win_height; i++){1622 if(screen_buffer[3*i]!=0 || screen_buffer[3*i+1]!=0 || screen_buffer[3*i+2]!=0)1623 fprintf(stderr, "(%d %d %d) ", screen_buffer[3*i], screen_buffer[3*i+1], screen_buffer[3*i+2]);1624 }1625 */1626 1817 } 1627 1818 … … 1686 1877 data = tmp; 1687 1878 1688 if(Tcl_Eval(interp, (char*)data.c_str()) != TCL_OK) { 1689 //error to log file... 1690 printf("Tcl error: %s\n", Tcl_GetStringResult(interp)); 1879 if (Tcl_Eval(interp, (char*)data.c_str()) != TCL_OK) { 1880 std::ostringstream errmsg; 1881 errmsg << "ERROR: " << Tcl_GetStringResult(interp) << std::endl; 1882 write(0, errmsg.str().c_str(), errmsg.str().size()); 1691 1883 return; 1692 1884 }
Note: See TracChangeset
for help on using the changeset viewer.