[vtkusers] Problem with Mesa and Offscreen Rendering

Alexander Trum alexander.trum at teraport.de
Tue Mar 16 18:27:16 EST 2004


Hello

I am using VTK 4.0 and Mesa 4.0.1 on Linux Suse 8.0.
Want i will do is to render a sphere in offscreen mode.

I have build VTK 4.0 with VTK_OPENGL_HAS_OSMESA:BOOL set to ON.

But when I start my program I got following segfault:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 16537)]
0x40121bd2 in _mesa_zbuffer_address () from /usr/lib/libGL.so.1
(gdb) bt
#0  0x40121bd2 in _mesa_zbuffer_address () from /usr/lib/libGL.so.1
#1  0x0823aeea in smooth_rgba_triangle () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#2  0x0825b078 in render_vb_triangles_raw () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#3  0x0825c82e in gl_render_vb () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#4  0x0820e079 in gl_run_pipeline () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#5  0x0825e196 in gl_execute_cassette () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#6  0x081f2eda in gl_cva_compile_cassette () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#7  0x0825ca64 in gl_maybe_transform_vb () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#8  0x082580fc in _mesa_Vertex3fv () at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/IO/vtkTIFFWriter.cxx:523
#9  0x080c00f1 in vtkOpenGLDrawN013 (aPrim=0x84da140, aGlFunction=9, 
p=0x84d81b0, n=0x84d9190, ren=0x84ae628, noAbort=@0xbfffe5c4)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkOpenGLPolyDataMapper.cxx:469
#10 0x080c4d1d in vtkOpenGLPolyDataMapper::Draw (this=0x84ae040, 
aren=0x84ae628, act=0x84ae280)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkOpenGLPolyDataMapper.cxx:2782
#11 0x080bfab9 in vtkOpenGLPolyDataMapper::RenderPiece (this=0x84ae040, 
ren=0x84ae628, act=0x84ae280)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkOpenGLPolyDataMapper.cxx:307
#12 0x080accf2 in vtkPolyDataMapper::Render (this=0x84ae040, 
ren=0x84ae628, act=0x84ae280)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkPolyDataMapper.cxx:83
#13 0x080bd24f in vtkOpenGLActor::Render (this=0x84ae280, ren=0x84ae628, 
mapper=0x84ae040)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkOpenGLActor.cxx:128
#14 0x080aa4dd in vtkActor::RenderOpaqueGeometry (this=0x84ae280, 
vp=0x84ae628)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkActor.cxx:185
#15 0x080b5c72 in vtkRenderer::UpdateGeometry (this=0x84ae628) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderer.cxx:475
#16 0x080c592a in vtkOpenGLRenderer::DeviceRender (this=0x84ae628)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkOpenGLRenderer.cxx:207
#17 0x080b4d4b in vtkRenderer::Render (this=0x84ae628) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderer.cxx:250
#18 0x080b9d28 in vtkRendererCollection::Render (this=0x84aea30)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRendererCollection.cxx:92
#19 0x080b156d in vtkRenderWindow::DoStereoRender (this=0x84ae8f8)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderWindow.cxx:663
#20 0x080b1526 in vtkRenderWindow::DoFDRender (this=0x84ae8f8) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderWindow.cxx:651
#21 0x080b1192 in vtkRenderWindow::DoAARender (this=0x84ae8f8) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderWindow.cxx:545
#22 0x080b0a63 in vtkRenderWindow::Render (this=0x84ae8f8) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkRenderWindow.cxx:371
#23 0x080d18a2 in vtkXOpenGLRenderWindow::Render (this=0x84ae8f8)
     at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Rendering/vtkXOpenGLRenderWindow.cxx:1155
#24 0x080a9cf0 in main (argc=1, argv=0xbffff114) at 
/net/mwz20882/fs2/home/atrum/proj/offscreenRendering/dmu/vtk/src/Offscreen/main.cpp:33
#25 0x403c19ed in __libc_start_main () from /lib/libc.so.6



Here is my little program:

#include <stdio.h>
#include <stdlib.h>

#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkWindowToImageFilter.h"
#include "vtkTIFFWriter.h"

int main(int argc, char** argv) {
   vtkSphereSource* sphere = vtkSphereSource::New();
   sphere->SetRadius(100.0);
   sphere->SetThetaResolution(18);
   sphere->SetPhiResolution(18);

   vtkMapper::GlobalImmediateModeRenderingOn();
   vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
   mapper->SetInput(sphere->GetOutput());

   vtkActor* actor = vtkActor::New();
   actor->SetMapper(mapper);

   vtkRenderer* ren1 = vtkRenderer::New();
   ren1->AddActor(actor);

   vtkRenderWindow* renWin = vtkRenderWindow::New();
   renWin->OffScreenRenderingOn();
   renWin->AddRenderer(ren1);

   fprintf(stdout, "rendering ...");
   renWin->Render();

   fprintf(stdout, "creating image ...");
   vtkWindowToImageFilter* w2if = vtkWindowToImageFilter::New();
   w2if->SetInput(renWin);

   fprintf(stdout, "writing image ...");
   vtkTIFFWriter* writeTIFF = vtkTIFFWriter::New();
   writeTIFF->SetInput(w2if->GetOutput());
   writeTIFF->SetFileName("out.jpg");
   writeTIFF->Write();
   writeTIFF->Delete();
}


Please help,
   Alex

-- 
Alexander Trum
Dipl.-Math. (FH)
Senior Software Developer
Engineering IT Consulting
Teraport GmbH
Phone +49 89 651086 721
Fax +49 89 651086 701
Mobile +49 173 38 25 490
mailto:alexander.trum at teraport.de
http://www.teraport.de




More information about the vtkusers mailing list