Changeset 1194 for trunk/packages/vizservers/nanovis/nanovis.cpp
- Timestamp:
- Oct 28, 2008, 12:05:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/nanovis.cpp
r1193 r1194 104 104 int NanoVis::updir = Y_POS; 105 105 NvCamera* NanoVis::cam = NULL; 106 bool NanoVis::axis_on = true;107 int NanoVis::win_width = NPIX; //size of the render window108 int NanoVis::win_height = NPIX; //size of the render window109 106 int NanoVis::n_volumes = 0; 110 unsigned char* NanoVis::screen_buffer = NULL;107 vector<Volume*> NanoVis::volume; 111 108 vector<HeightMap*> NanoVis::heightMap; 112 109 VolumeRenderer* NanoVis::vol_renderer = 0; … … 119 116 graphics::RenderContext* NanoVis::renderContext = 0; 120 117 NvLIC* NanoVis::licRenderer = 0; 118 R2Fonts* NanoVis::fonts; 121 119 122 120 FILE *NanoVis::stdin = NULL; … … 127 125 bool NanoVis::particle_on = false; 128 126 bool NanoVis::vector_on = false; 127 bool NanoVis::axis_on = true; 129 128 bool NanoVis::config_pending = false; 129 bool NanoVis::debug_flag = false; 130 130 131 131 Tcl_Interp *NanoVis::interp; … … 136 136 NVISid NanoVis::final_color_tex = 0; 137 137 NVISid NanoVis::final_depth_rb = 0; 138 int render_window; //the handle of the render window; 139 140 // pointers to volumes, currently handle up to 10 volumes 141 /*FIXME: Is the above comment true? Is there a 10 volume limit */ 142 vector<Volume*> NanoVis::volume; 143 144 //if true nanovis renders volumes in 3D, if not renders 2D plane 138 int NanoVis::render_window = 0; /* GLUT handle for the render window */ 139 int NanoVis::win_width = NPIX; /* Width of the render window */ 140 int NanoVis::win_height = NPIX; /* Height of the render window */ 141 142 unsigned char* NanoVis::screen_buffer = NULL; 143 145 144 /* FIXME: This variable is always true. */ 146 145 bool volume_mode = true; 147 146 147 #ifdef notdef 148 148 // color table for built-in transfer function editor 149 149 float color_table[256][4]; 150 151 int debug_flag = false; 150 #endif 152 151 153 152 // in Command.cpp … … 168 167 CGparameter m_passthru_scale_param, m_passthru_bias_param; 169 168 170 R2Fonts* NanoVis::fonts;171 169 172 170 // Variables for mouse events … … 411 409 start = CVT2SECS(tv); 412 410 413 if ( debug_flag) {414 fprintf(NanoVis::logfile, " %s\n", Tcl_DStringValue(dsPtr));411 if (NanoVis::debug_flag) { 412 fprintf(NanoVis::logfile, "(%s)\n", Tcl_DStringValue(dsPtr)); 415 413 } 416 414 if (NanoVis::recfile != NULL) { 417 fprintf(NanoVis::recfile, "%s \n", Tcl_DStringValue(dsPtr));415 fprintf(NanoVis::recfile, "%s", Tcl_DStringValue(dsPtr)); 418 416 fflush(NanoVis::recfile); 419 417 } … … 507 505 } 508 506 507 #ifdef notdef 509 508 //Update the transfer function using local GUI in the non-server mode 510 509 void 511 510 update_tf_texture() 512 511 { 513 glutSetWindow( render_window);512 glutSetWindow(NanoVis::render_window); 514 513 515 514 //fprintf(stderr, "tf update\n"); … … 537 536 #endif 538 537 } 538 #endif 539 539 540 540 int … … 1216 1216 1217 1217 /*----------------------------------------------------*/ 1218 static void 1219 idle() 1220 { 1218 void 1219 NanoVis::idle() 1220 { 1221 if (debug_flag) { 1222 fprintf(stderr, "in idle()\n"); 1223 } 1221 1224 glutSetWindow(render_window); 1222 1225 … … 1228 1231 #endif 1229 1232 #ifdef XINETD 1230 NanoVis::xinetd_listen();1233 xinetd_listen(); 1231 1234 #else 1232 1235 glutPostRedisplay(); 1233 1236 #endif 1237 if (debug_flag) { 1238 fprintf(stderr, "leaving idle()\n"); 1239 } 1234 1240 } 1235 1241 … … 1237 1243 NanoVis::display_offscreen_buffer() 1238 1244 { 1245 if (debug_flag) { 1246 fprintf(stderr, "in display_offscreen_buffer\n"); 1247 } 1239 1248 glEnable(GL_TEXTURE_2D); 1240 1249 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); … … 1257 1266 } 1258 1267 glEnd(); 1268 if (debug_flag) { 1269 fprintf(stderr, "leaving display_offscreen_buffer\n"); 1270 } 1259 1271 } 1260 1272 … … 1600 1612 double xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax; 1601 1613 1614 if (debug_flag) { 1615 fprintf(stderr, "in SetVolumeRanges\n"); 1616 } 1602 1617 xMin = yMin = zMin = wMin = DBL_MAX; 1603 1618 xMax = yMax = zMax = wMax = -DBL_MAX; … … 1651 1666 } 1652 1667 Volume::update_pending = false; 1668 if (debug_flag) { 1669 fprintf(stderr, "leaving SetVolumeRanges\n"); 1670 } 1653 1671 } 1654 1672 … … 1658 1676 double xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax; 1659 1677 1678 if (debug_flag) { 1679 fprintf(stderr, "in SetHeightmapRanges\n"); 1680 } 1660 1681 xMin = yMin = zMin = wMin = DBL_MAX; 1661 1682 xMax = yMax = zMax = wMax = -DBL_MAX; … … 1715 1736 } 1716 1737 HeightMap::update_pending = false; 1738 if (debug_flag) { 1739 fprintf(stderr, "leaving SetHeightmapRanges\n"); 1740 } 1717 1741 } 1718 1742 … … 1721 1745 NanoVis::display() 1722 1746 { 1747 if (debug_flag) { 1748 fprintf(stderr, "in display\n"); 1749 } 1723 1750 //assert(glGetError()==0); 1724 1751 if (HeightMap::update_pending) { … … 1728 1755 SetVolumeRanges(); 1729 1756 } 1757 if (debug_flag) { 1758 fprintf(stderr, "in display: glClear\n"); 1759 } 1730 1760 //start final rendering 1731 1761 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear screen 1732 1762 1733 1763 if (volume_mode) { 1764 if (debug_flag) { 1765 fprintf(stderr, "in display: volume_mode\n"); 1766 } 1734 1767 //3D rendering mode 1735 1768 glEnable(GL_TEXTURE_2D); … … 1796 1829 //perf->disable(); 1797 1830 1831 if (debug_flag) { 1832 fprintf(stderr, "in display: render heightmap\n"); 1833 } 1798 1834 for (unsigned int i = 0; i < heightMap.size(); ++i) { 1799 1835 if (heightMap[i]->isVisible()) { … … 1814 1850 #endif 1815 1851 perf->reset(); 1852 if (debug_flag) { 1853 fprintf(stderr, "leaving display\n"); 1854 } 1816 1855 1817 1856 } … … 2008 2047 init_service() 2009 2048 { 2010 if (! debug_flag) {2049 if (!NanoVis::debug_flag) { 2011 2050 //open log and map stderr to log file 2012 2051 xinetd_log = fopen("/tmp/log.txt", "w"); … … 2109 2148 fcntl(0, F_SETFL, flags | O_NONBLOCK); 2110 2149 npass++; 2150 if (NanoVis::debug_flag) { 2151 break; 2152 } 2111 2153 } 2112 2154 fcntl(0, F_SETFL, flags); … … 2195 2237 glutInitWindowSize(NanoVis::win_width, NanoVis::win_height); 2196 2238 glutInitWindowPosition(10, 10); 2239 NanoVis::render_window = glutCreateWindow("nanovis"); 2197 2240 glutDisplayFunc(NanoVis::display); 2198 glutIdleFunc( idle);2241 glutIdleFunc(NanoVis::idle); 2199 2242 glutReshapeFunc(NanoVis::resize_offscreen_buffer); 2243 2200 2244 #ifndef XINETD 2201 2245 glutMouseFunc(NanoVis::mouse); … … 2203 2247 glutKeyboardFunc(NanoVis::keyboard); 2204 2248 #endif 2205 2206 render_window = glutCreateWindow("nanovis");2207 2249 2208 2250 … … 2241 2283 case 3: 2242 2284 case 'd': 2243 debug_flag = true;2285 NanoVis::debug_flag = true; 2244 2286 break; 2245 2287 case 0: 2246 2288 case 'i': 2247 fprintf(stderr, "opening infile %s\n", optarg);2248 2289 NanoVis::stdin = fopen(optarg, "r"); 2249 2290 if (NanoVis::stdin == NULL) { … … 2254 2295 case 1: 2255 2296 case 'l': 2256 fprintf(stderr, "opening logfile %s\n", optarg);2257 2297 NanoVis::logfile = fopen(optarg, "w"); 2258 2298 if (NanoVis::logfile == NULL) { … … 2266 2306 char buf[200]; 2267 2307 2268 fprintf(stderr, "Recording commands to %s\n", optarg);2269 2308 Tcl_DStringInit(&ds); 2270 2309 Tcl_DStringAppend(&ds, optarg, -1); … … 2321 2360 NvInitEventLog(); 2322 2361 #endif 2323 //event loop2324 2362 glutMainLoop(); 2325 2363
Note: See TracChangeset
for help on using the changeset viewer.