[vtkusers] Black image with offscreen rendering(using osmesa)

Kevin H. Hobbs hobbsk at ohiou.edu
Sun Feb 7 12:42:32 EST 2010


On 02/07/2010 09:24 AM, Hassan Amin wrote:
> I have tried compiling Mesa 5.0.2 and vtk 5.0.3 using the instructions on :
>
> http://www.vtk.org/Wiki/VTK:How_I_mangled_Mesa
>   

First things first : Please include vtkusers at vtk.org in the list of
recipients of your e-mails.

Mangled Mesa is no longer supported by either Mesa or VTK.

The first step is to get the latest version of mesa:

    wget ftp://ftp.freedesktop.org/pub/mesa/7.6.1/MesaLib-7.6.1.tar.bz2

Un-tar it :

    tar -xjvf MesaLib-7.6.1.tar.bz2

Build it :

    cd Mesa-7.6.1/
    make linux-x86-64

Note: the mesa build depends on the depreciated X build tool imake which
is often not installed by default.

Get the latest version of VTK :

    wget http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz

Un-tar it :

    tar -xzvf vtk-5.4.2.tar.gz

Make a build directory for VTK :

    mkdir VTK_Build

Configure VTK in the build directory :

    cd VTK_Build/
    cmake \
        -D
OPENGL_INCLUDE_DIR:PATH=/home/kevin/OSMesaDemo/Mesa-7.6.1/include/ \
        -D
OPENGL_gl_LIBRARY:FILEPATH=/home/kevin/OSMesaDemo/Mesa-7.6.1/lib64/libGL.so
\
        -D
OPENGL_glu_LIBRARY:FILEPATH=/home/kevin/OSMesaDemo/Mesa-7.6.1/lib64/libGLU.so
\
        -D VTK_OPENGL_HAS_OSMESA:BOOL=ON \
        -D
OSMESA_INCLUDE_DIR:PATH=/home/kevin/OSMesaDemo/Mesa-7.6.1/include/ \
        -D
OSMESA_LIBRARY:FILEPATH=/home/kevin/OSMesaDemo/Mesa-7.6.1/lib64/libOSMesa.so
\
        ../VTK

Build VTK ( you can do this in parallel if you have a multi-core CPU )

    make -j8

Copy the text of the example program and CMakeLists.txt file from :

    http://www.vtk.org/Wiki/VTK/Examples/OffScreenRendering

    cd ..
    gvim OffScreenRendering.cxx
    gvim CMakeLists.txt
    cmake -D VTK_DIR:PATH=/home/kevin/OSMesaDemo/VTK_Build ./
    make
    unset DISPLAY
    ./OffScreenRendering

You should now have a picture of a sphere in screenshot.png.

You will of course have to replace "/home/kevin/OSMesaDemo/" with
whatever you like everywhere it appears above.




 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100207/776661be/attachment.pgp>


More information about the vtkusers mailing list