[vtkusers] how to compile VTK for offscreen rendering
Kevin H. Hobbs
hobbsk at ohiou.edu
Thu Jun 14 13:39:07 EDT 2007
On Wed, 2007-06-13 at 12:55 -0400, Evan Bollig wrote:
> Can anyone give me precise instructions for compiling VTK 5.0.3 in
> offscreen rendering mode. I have followed my own instructions for
> mangling mesa and compiling the package but I get erronous results.
> For starters, volume rendering does not work, contours do not work,
> and my rendered results (jpegs) are only half complete (half the image
> is missing).
>
> Id like to compare notes with someone to know that Im compiling VTK correctly.
>
> Let me know,
> -Evan
>
Can I assume you're using linux and GCC?
Do you really need to mangled mesa? It is only for combining Mesa with
another (hardware accelerated) libGL that cannot do offscreen rendering
in the same copy of VTK. I hear the name mangling in mesa does not work
from time to time. I've never made it work.
What works is to use pure Mesa.
Build Mesa.
Tell CMake where to find Mesa.
Build VTK.
Tell VTK to use offscreen rendering in your program.
I just build Mesa with:
make linux-x86-64
To tell CMake where to find Mesa I have these lines, edited to get rid
of non Mesa stuff, in my .bash_profile:
MESA=~/Mesa-6.4.2
CMAKE_LIBRARY_PATH=$MESA/lib64:$CMAKE_LIBRARY_PATH
export CMAKE_LIBRARY_PATH
CMAKE_INCLUDE_PATH=$MESA/include
export CMAKE_INCLUDE_PATH
When I build VTK I set the options for Mesa in my CMake script:
VTK_OPENGL_HAS_OSMESA:BOOL=ON
I do not set VTK_USE_OFFSCREEN because it just causes trouble. CMake
finds libGL.so from Mesa because of the paths I set above:
[kevin at gargon ~]$ grep Mesa-6.4.2 kitware/VTK_Build_Mesa/CMakeCache.txt
OPENGL_INCLUDE_DIR:PATH=/home/kevin/Mesa-6.4.2/include
OPENGL_gl_LIBRARY:FILEPATH=/home/kevin/Mesa-6.4.2/lib64/libGL.so
OPENGL_glu_LIBRARY:FILEPATH=/home/kevin/Mesa-6.4.2/lib64/libGLU.so
OPENGL_xmesa_INCLUDE_DIR:PATH=/home/kevin/Mesa-6.4.2/include
OSMESA_INCLUDE_DIR:PATH=/home/kevin/Mesa-6.4.2/include
OSMESA_LIBRARY:FILEPATH=/home/kevin/Mesa-6.4.2/lib64/libOSMesa.so
.
.
.
When I build my program I tell VTK to use offscreen classes with these
lines at the top of my program, you also have to include their headers.
#include "vtkGraphicsFactory.h"
#include "vtkImagingFactory.h"
int main( int argc, char * argv[] )
{
// Graphics Factory
vtkGraphicsFactory * graphics_factory
= vtkGraphicsFactory::New();
graphics_factory->SetOffScreenOnlyMode( 1);
graphics_factory->SetUseMesaClasses( 1 );
// Imaging Factory
vtkImagingFactory * imaging_factory
= vtkImagingFactory::New();
imaging_factory->SetUseMesaClasses( 1 );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070614/e0f2721b/attachment.pgp>
More information about the vtkusers
mailing list