Changeset 1299 for trunk/packages/vizservers/nanovis/nanovis.cpp
- Timestamp:
- Mar 7, 2009 2:46:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/nanovis.cpp
r1295 r1299 153 153 // in Command.cpp 154 154 extern Tcl_Interp *initTcl(); 155 156 // in dxReader.cpp 157 extern void load_vector_stream(int index, std::istream& fin); 155 158 156 159 float vert[NMESH*NMESH*3]; //particle positions in main memory … … 399 402 assert(path != NULL); 400 403 } 404 printf("cg program compiling: %s\n", path); 405 fflush(stdout); 401 406 CGprogram program; 402 407 program = cgCreateProgramFromFile(context, CG_SOURCE, path, profile, 403 408 entryPoint, NULL); 409 cgGLLoadProgram(program); 410 411 CGerror LastError = cgGetError(); 412 if (LastError) 413 { 414 printf("Error message: %s\n", cgGetLastListing(context)); 415 } 416 404 417 delete [] path; 405 cgGLLoadProgram(program); 418 406 419 return program; 407 420 } … … 1864 1877 } 1865 1878 //3D rendering mode 1866 glEnable(GL_TEXTURE_2D); 1879 // TBD.. 1880 //glEnable(GL_TEXTURE_2D); 1867 1881 glEnable(GL_DEPTH_TEST); 1868 1882 … … 1991 2005 1992 2006 angle = cam->rotate(); 1993 angle.x += delta .x;1994 angle.y += delta .y;2007 angle.x += delta_x; 2008 angle.y += delta_y; 1995 2009 1996 2010 if (angle.x > 360.0) { … … 2018 2032 NanoVis::keyboard(unsigned char key, int x, int y) 2019 2033 { 2034 /* 2020 2035 bool log = false; 2021 2036 … … 2026 2041 case '+': 2027 2042 lic_slice_z+=0.05; 2028 lic ->set_offset(lic_slice_z);2043 licRenderer->set_offset(lic_slice_z); 2029 2044 break; 2030 2045 case '-': 2031 2046 lic_slice_z-=0.05; 2032 lic ->set_offset(lic_slice_z);2047 licRenderer->set_offset(lic_slice_z); 2033 2048 break; 2034 2049 case ',': … … 2083 2098 break; 2084 2099 } 2100 */ 2085 2101 #ifdef EVENTLOG 2086 2102 if(log){ … … 2197 2213 #endif 2198 2214 2215 void 2216 NanoVis::render() 2217 { 2218 if (NanoVis::licRenderer && NanoVis::licRenderer->isActivated()) 2219 { 2220 NanoVis::licRenderer->convolve(); 2221 } 2222 2223 if (NanoVis::particleRenderer && NanoVis::particleRenderer->isActivated()) 2224 { 2225 NanoVis::particleRenderer->advect(); 2226 } 2227 2228 NanoVis::update(); 2229 2230 display(); 2231 glutSwapBuffers(); 2232 2233 } 2234 2235 void 2236 NanoVis::resize(int x, int y) 2237 { 2238 glViewport(0, 0, x, y); 2239 } 2199 2240 2200 2241 void … … 2361 2402 glutInitWindowPosition(10, 10); 2362 2403 NanoVis::render_window = glutCreateWindow("nanovis"); 2363 glutDisplayFunc(NanoVis::display);2364 2404 glutIdleFunc(NanoVis::idle); 2365 glutReshapeFunc(NanoVis::resize_offscreen_buffer);2366 2405 2367 2406 #ifndef XINETD … … 2369 2408 glutMotionFunc(NanoVis::motion); 2370 2409 glutKeyboardFunc(NanoVis::keyboard); 2371 #endif 2372 2410 glutReshapeFunc(NanoVis::resize); 2411 glutDisplayFunc(NanoVis::render); 2412 #else 2413 glutDisplayFunc(NanoVis::display); 2414 glutReshapeFunc(NanoVis::resize_offscreen_buffer); 2415 #endif 2373 2416 2374 2417 while (1) { … … 2450 2493 // Assume program is in the form <path>/bin/nanovis. 2451 2494 2495 #ifdef XINETD 2452 2496 path = argv[0]; 2453 2497 p = strrchr(path, '/'); … … 2464 2508 sprintf(newPath, "%s/lib/shaders:%s/lib/resources", path, path); 2465 2509 path = newPath; 2510 #else 2511 char buff[256]; 2512 getcwd(buff, 255); 2513 p = strrchr(buff, '/'); 2514 if (p != NULL) { 2515 *p = '\0'; 2516 } 2517 newPath = new char[(strlen(buff) + 15) * 2 + 1]; 2518 sprintf(newPath, "%s/lib/shaders:%s/lib/resources", buff, buff); 2519 path = newPath; 2520 #endif 2466 2521 } 2467 2522 R2FilePath::getInstance()->setWorkingDirectory(argc, (const char**) argv); … … 2483 2538 NanoVis::interp = initTcl(); 2484 2539 NanoVis::resize_offscreen_buffer(NanoVis::win_width, NanoVis::win_height); 2540 2541 #ifndef XINETD 2542 /* 2543 CGprofile newProfile; 2544 newProfile = cgGetProfile("fp30"); 2545 if (newProfile == CG_PROFILE_UNKNOWN) 2546 printf("unknown profile\n"); 2547 else printf("fp30 know profile\n"); 2548 2549 int n = NanoVis::n_volumes; 2550 std::ifstream fdata; 2551 fdata.open("flow2d.dx", std::ios::in); 2552 load_vector_stream(n, fdata); 2553 Volume *volPtr = NanoVis::volume[n]; 2554 2555 if (volPtr != NULL) { 2556 //volPtr->set_n_slice(256-n); 2557 volPtr->set_n_slice(512-n); 2558 volPtr->disable_cutplane(0); 2559 volPtr->disable_cutplane(1); 2560 volPtr->disable_cutplane(2); 2561 2562 NanoVis::vol_renderer->add_volume(volPtr, 2563 NanoVis::get_transfunc("default")); 2564 } 2565 2566 2567 if (NanoVis::particleRenderer != NULL) { 2568 NanoVis::particleRenderer->setVectorField(volPtr->id, 1.0f, 2569 volPtr->height / (float)volPtr->width, 2570 volPtr->depth / (float)volPtr->width, 2571 volPtr->wAxis.max()); 2572 NanoVis::initParticle(); 2573 } 2574 if (NanoVis::licRenderer != NULL) { 2575 NanoVis::licRenderer->setVectorField(volPtr->id, 2576 1.0f / volPtr->aspect_ratio_width, 2577 1.0f / volPtr->aspect_ratio_height, 2578 1.0f / volPtr->aspect_ratio_depth, 2579 volPtr->wAxis.max()); 2580 NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z); 2581 } 2582 */ 2583 #endif 2485 2584 glutMainLoop(); 2486 2585
Note: See TracChangeset
for help on using the changeset viewer.