Changeset 380 for trunk/gui/vizservers/nanovis
- Timestamp:
- Mar 27, 2006, 9:54:02 PM (18 years ago)
- Location:
- trunk/gui/vizservers/nanovis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/nanovis/TransferFunction.cpp
r379 r380 21 21 TransferFunction::TransferFunction(int _size, float* data){ 22 22 23 tex = new Texture1D(size, GL_UNSIGNED_BYTE); 24 id = tex->id; 23 tex = new Texture1D(_size, GL_FLOAT); 25 24 26 25 tex->initialize_float_rgba(data); 26 id = tex->id; 27 27 } 28 28 … … 30 30 TransferFunction::~TransferFunction(){ delete tex; } 31 31 32 void TransferFunction::update(float* data){ 33 tex->update_float_rgba(data); 34 } 32 35 33 36 -
trunk/gui/vizservers/nanovis/TransferFunction.h
r379 r380 26 26 Texture1D* tex; //the texture storing the colors 27 27 28 public: 28 29 GLuint id; //OpenGL's texture identifier 29 30 31 public:32 30 TransferFunction(int _size, float* data); 33 31 ~TransferFunction(); 32 void update(float* data); 34 33 }; 35 34 -
trunk/gui/vizservers/nanovis/config.h
r261 r380 15 15 16 16 17 //#define NV40 //Uncomment if using 6 series card. By default we assume older card the 5xxx series17 #define NV40 //Uncomment if using 6 series card. By default we assume older card the 5xxx series -
trunk/gui/vizservers/nanovis/nanovis.cpp
r379 r380 24 24 #include "RpFieldPrism3D.h" 25 25 26 //transfer function headers 26 27 #include "transfer-function/TransferFunctionMain.h" 27 28 #include "transfer-function/ControlPoint.h" … … 31 32 #include "transfer-function/MainWindow.h" 32 33 33 float color_table[256][4]; 34 34 float color_table[256][4]; 35 36 int render_window; //the handle of the render window; 35 37 // forward declarations 36 38 void init_particles(); … … 75 77 CGprogram m_one_volume_fprog; 76 78 CGparameter m_vol_one_volume_param; 79 CGparameter m_tf_one_volume_param; 77 80 CGparameter m_mvi_one_volume_param; 78 81 CGparameter m_render_param_one_volume_param; … … 528 531 529 532 533 //load value from the gui, only one transfer function 534 extern void update_tf_texture(){ 535 glutSetWindow(render_window); 536 537 fprintf(stderr, "tf update\n"); 538 if(tf[0]==0) return; 539 540 float data[256*4]; 541 for(int i=0; i<256; i++){ 542 data[4*i+0] = color_table[i][0]; 543 data[4*i+1] = color_table[i][1]; 544 data[4*i+2] = color_table[i][2]; 545 data[4*i+3] = color_table[i][3]; 546 fprintf(stderr, "(%f,%f,%f,%f) ", data[4*i+0], data[4*i+1], data[4*i+2], data[4*i+3]); 547 } 548 549 tf[0]->update(data); 550 } 551 552 553 530 554 //initialize frame buffer objects for offscreen rendering 531 555 void init_fbo(){ … … 689 713 m_vol_one_volume_param = cgGetNamedParameter(m_one_volume_fprog, "volume"); 690 714 cgGLSetTextureParameter(m_vol_one_volume_param, volume[0]->id); 715 m_tf_one_volume_param = cgGetNamedParameter(m_one_volume_fprog, "tf"); 716 cgGLSetTextureParameter(m_tf_one_volume_param, tf[0]->id); 691 717 m_mvi_one_volume_param = cgGetNamedParameter(m_one_volume_fprog, "modelViewInv"); 692 718 m_render_param_one_volume_param = cgGetNamedParameter(m_one_volume_fprog, "renderParameters"); … … 738 764 739 765 740 766 void init_tf(){ 767 float data[256*4]; 768 memset(data, 0, 4*256*sizeof(float)); 769 770 tf[0] = new TransferFunction(256, data); 771 } 741 772 742 773 … … 792 823 load_vector_file(0, "./data/J-wire-vec.dx"); 793 824 load_volume_file(1, "./data/mu-wire-3d.dx"); 825 826 init_tf(); //initialize transfer function 794 827 795 828 init_fbo(); //frame buffer objects … … 952 985 /*----------------------------------------------------*/ 953 986 void idle(){ 987 glutSetWindow(render_window); 988 954 989 struct timespec ts; 955 990 ts.tv_sec = 0; … … 1352 1387 cgGLSetTextureParameter(m_vol_one_volume_param, volume[volume_index]->id); 1353 1388 cgGLEnableTextureParameter(m_vol_one_volume_param); 1389 cgGLEnableTextureParameter(m_tf_one_volume_param); 1354 1390 1355 1391 //hack! … … 1369 1405 cgGLDisableProfile(CG_PROFILE_FP30); 1370 1406 1371 cgGLEnableTextureParameter(m_vol_one_volume_param); 1372 //cgGLDisableTextureParameter(m_vel_tex_param); 1373 //cgGLDisableTextureParameter(m_pos_tex_param); 1407 cgGLDisableTextureParameter(m_vol_one_volume_param); 1408 cgGLDisableTextureParameter(m_tf_one_volume_param); 1374 1409 } 1375 1410 … … 1928 1963 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); 1929 1964 1930 MainTransferFunctionWindow * mainWin;1931 mainWin= new MainTransferFunctionWindow();1932 mainWin->mainInit();1965 MainTransferFunctionWindow * tf_window; 1966 tf_window = new MainTransferFunctionWindow(); 1967 tf_window->mainInit(); 1933 1968 1934 1969 glutInitWindowSize(NPIX, NPIX); 1935 1970 glutInitWindowPosition(10, 10); 1936 glutCreateWindow(argv[0]);1971 render_window = glutCreateWindow(argv[0]); 1937 1972 1938 1973 glutDisplayFunc(display); -
trunk/gui/vizservers/nanovis/shaders/one_volume.cg
r378 r380 17 17 PixelOut main(v2f IN, /* uniform sampler1D tf,*/ 18 18 uniform sampler3D volume, 19 //uniform sampler1D map,19 uniform sampler1D tf, 20 20 uniform float4x4 modelViewInv, 21 21 uniform float4 renderParameters) … … 34 34 else{ 35 35 //shades of red //more opaque 36 OUT.Color = float4(sample, 0, 0, 7*sample/renderParameters.x); 36 OUT.Color = tex1D(tf, sample); 37 OUT.Color.w = 10*OUT.Color.w/renderParameters.x; 37 38 38 if(sample<0.6 && sample>0.4){ 39 OUT.Color = float4(0, 0, 1, 10*sample/renderParameters.x); 40 } 39 //OUT.Color = float4(sample, 0, 0, 7*sample/renderParameters.x); 40 41 //if(sample<0.6 && sample>0.4){ 42 //OUT.Color = float4(0, 0, 1, 10*sample/renderParameters.x); 43 //} 41 44 } 42 45 } -
trunk/gui/vizservers/nanovis/transfer-function/ColorPaletteWindow.cpp
r379 r380 106 106 107 107 108 void update_tf_texture() {};108 void update_tf_texture(); 109 109 110 110 void ColorPalette::cmdHandler(int arg){
Note: See TracChangeset
for help on using the changeset viewer.