Personal tools
You are here: Home Software VTK and Paraview Compiling Paraview

Compiling Paraview

First, extract the source code and create a second directory where the executable files will be created. Go to this second directory and call ccmake:

~/src$ tar xfvz paraview-source.tar.gz
~/src$ mkdir paraview-build ; cd paraview-build
~/src/paraview-build$ ccmake ../paraview/

Press "c" for "configure" which sets most variables to correct values.

Set the following properties:

  • CMAKE_INSTALL_PREFIX: /home/SOFTWARE/paraview
  • VTK_USE_64BIT_IDS: ON

Then press again "c" to configure, then "g" to generate the Makefile. Then, VTK can be compiled and installed:

~/src/paraview-build$ make
~/src/paraview-build$ make install

MPI

First, you need the MPI libraries (MPICH or MPICH2):

~/src/mpich-1.2.7p1-bigmessagesize$ ./configure --prefix=/home/SOFTWARE/paraview -rsh="/usr/bin/ssh -X"
~/src/mpich-1.2.7p1-bigmessagesize$ make
~/src/mpich-1.2.7p1-bigmessagesize$ make install

In ccmake, you have to use the following settings before compiling (press "c" to update the options list):

  • VTK_USE_MPI: ON
  • MPI_EXTRA_LIBRARY: ~src/mpich-1.2.7p1-bigmessagesize/lib/libpmpich.a
  • MPI_INCLUDE_PATH: ~src/mpich-1.2.7p1-bigmessagesize/include
  • MPI_LIBRARY: ~src/mpich-1.2.7p1-bigmessagesize/lib/libpmpich.a

Note: Only static MPI libraries seemed to work.

After that, Paraview can be compiled as described above.

FFMPEG

If Paraview is compiled with ffmpeg support, it can create AVI videos. Download and compile ffmpeg like this:

$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
$ #./configure --prefix=/home/SOFTWARE/paraview/ffmpeg --enable-dv1394 --enable-libvorbis --enable-libgsm
$ ./configure --prefix=/home/SOFTWARE/VTK --enable-libvorbis --enable-gpl --enable-nonfree --enable-shared --enable-static --enable-pthreads --enable-x11grab
$ make
$ make install

Qt

Paraview 3.x needs the Qt library:

$ ./configure -prefix /home/SOFTWARE/paraview/qt
$ make
$ make install

Geowall: Stereo Modes

There are two possibilities, as described in Paraview on the Geowall — the "side-by-side mode" and the "clone mode". They require the following modifications:

  • Clone mode:
    • Edit the file paraview/VTK/Rendering/vtkRenderWindow.cxx
    • replace the first VTK_STEREO_RED_BLUE (in the function vtkRenderWindow::vtkRenderWindow()) by VTK_STEREO_CRYSTAL_EYES
  • Side-by-side mode:
    • Edit the file paraview/VTK/Rendering/vtkRenderWindow.h; this is the diff:
      57a58
      > #define VTK_STEREO_SVEN         8
      226a228,229
      >   void SetStereoTypeToSVEN()
      >     {this->SetStereoType(VTK_STEREO_SVEN);};
      524a528,529
      >     case VTK_STEREO_SVEN:
      >       return (char *)"SVENDisplay";
    • Edit the file paraview/VTK/Rendering/vtkRenderWindow.cxx; this is the diff:
      49c49,50
      <   this->StereoType = VTK_STEREO_RED_BLUE;
      ---
      >   //this->StereoType = VTK_STEREO_RED_BLUE;
      >   this->StereoType = VTK_STEREO_SVEN;
      763a765,767
      >       case VTK_STEREO_SVEN:
      >         this->StereoStatus = 1;
      >         break;      
      780a785,787
      >       case VTK_STEREO_SVEN:
      >         this->StereoStatus = 0;
      >         break;
      800a808
      >       (this->StereoType == VTK_STEREO_SVEN) ||
      816a825,899
      > // SVEN STEREO //////////////////////////////////////////////////////////////////
      > // <> /////////////////////////////////////////////////
      > //
      >     case VTK_STEREO_SVEN:
      >       {
      >       unsigned char *buff;
      >       unsigned char *p1, *p2, *p3;
      >       unsigned char* result;
      >       int *size;
      >       int halfLength;  //hlaf thelength, each eye gets half of teh window
      >       int x,y;
      >       int res;
      > 
      >       // get the size
      >       size = this->GetSize();
      >       halfLength = size[0]/2;
      >       
      >      // get the data
      >       buff = this->GetPixelData(0,0,size[0]-1,size[1]-1,!this->DoubleBuffer);
      >       p1 = this->StereoBuffer;
      >       p2 = buff;
      >       
      >       // allocate the result
      >       result = new unsigned char [size[0]*size[1]*3];
      >       if (!result)
      >         {
      >         vtkErrorMacro(<<"Couldn't allocate memory for SVEN stereo.");
      >         return;
      >         }
      >       p3 = result;
      > 
      > 
      >       // now put the two images next to each other
      >       for (y = 0; y < size[1]; y ++)
      >         {
      >         //Needed in case there is an odd number of pixel columns. 
      >         //Teh skipped line prevents some very odd results
      >         if(size[0]%2!=0){ 
      >           *p3++ = 0;
      >           *p3++ = 0;
      >           *p3++ = 0; p1 += 3; p2 += 3;
      >         }
      > 
      >         //left eye on the left half 
      > 	p1 +=  halfLength/2 * 3;
      >         for (x = 0; x < halfLength; x++) 
      >           {
      >           *p3++ = *p1++;
      >           *p3++ = *p1++;
      >           *p3++ = *p1++;
      >           }
      > 	p1 += (halfLength - halfLength/2) *3;
      > 
      >         //righ eye on the right half
      > 	p2 +=  halfLength/2 * 3;
      >         for (x = 0; x < halfLength; x++) 
      >           {
      >           *p3++ = *p2++;
      >           *p3++ = *p2++;
      >           *p3++ = *p2++;
      >           }
      > 	p2 += (halfLength - halfLength/2) *3;
      >         }
      > 
      > 
      > 
      >       this->ResultFrame = result;
      >       delete [] this->StereoBuffer;
      >       this->StereoBuffer = NULL;
      >       delete [] buff;
      >       }
      >       break;
      > 
      > // SVEN STEREO //////////////////////////////////////////////////////////////////
      > 
      

Geowall: Adjusting the Eye Angle

The 3D effect is very impressive, but becomes too strong when the object is very close. So if you want to be able to have a close look to the structures without switching off the stereo mode, you can reduce the eye angle in the source code. Just edit the file paraview/VTK/Rendering/vtkCamera.cxx and change the following line:

this->EyeAngle = 2.0;

to:

this->EyeAngle = 0.5;

Maybe there are better ways to achive this; at least, it works.

Compiling and Installing VTK

For VTK, Tcl and Tk are required, so they are compiled and installed first.

Tcl (8.4.12):

~/src/tcl8.4.12/unix$ ./configure --prefix=/home/SOFTWARE/VTK
~/src/tcl8.4.12/unix$ make
~/src/tcl8.4.12/unix$ make install

Tk (8.4.12):

~/src/tk8.4.12/unix$ ./configure --prefix=/home/SOFTWARE/VTK
~/src/tk8.4.12/unix$ make
~/src/tk8.4.12/unix$ make install

VTK (5.0):

~/src/VTK-build$ ccmake ../VTK/

Press "c" for "configure" which sets most variables to correct values.

Set the following properties:

  • BUILD_SHARED_LIBS: ON
  • CMAKE_INSTALL_PREFIX: /home/SOFTWARE/VTK
  • TCL_INCLUDE_PATH: /home/SOFTWARE/VTK/include
  • TCL_LIBRARY: /home/SOFTWARE/VTK/lib/libtcl8.4.so
  • TCL_TCLSH: /home/SOFTWARE/VTK/bin/tclsh8.4
  • TK_INCLUDE_PATH: /home/SOFTWARE/VTK/include
  • TK_LIBRARY: /home/SOFTWARE/VTK/lib/libtk8.4
  • VTK_OPENGL_HAS_OSMESA: OFF
  • VTK_TCL_TK_STATIC: OFF
  • VTK_USE_TK: ON

Additionally the following settings could be useful:

  • VTK_USE_64BIT_IDS: ON
  • VTK_USE_MPI: ON
  • MPI_EXTRA_LIBRARY: ~src/mpich-1.2.7p1-bigmessagesize/lib/libpmpich.a
  • MPI_INCLUDE_PATH: ~src/mpich-1.2.7p1-bigmessagesize/include
  • MPI_LIBRARY: ~src/mpich-1.2.7p1-bigmessagesize/lib/libpmpich.a

Then press again "c" to configure, then "g" to generate the Makefile. Then, VTK can be compiled and installed:

~/src/VTK-build$ make
~/src/VTK-build$ make install
Document Actions