[vtkusers] Offscreen rendering

Berk Geveci berk.geveci at gmail.com
Fri Apr 14 09:20:09 EDT 2006


Try Mesa 6.0.1 and see what happens. Amy Henderson had problems with
6.5 and when she tried 6.0.1, it worked fine. I think mangling might
be broken in 6.5

-Berk

On 4/11/06, John Norris <jnorris at mcs.anl.gov> wrote:
> Hi,
>
> I cannot for the life of me get offscreen rendering to work.  This is on
> AIX 5.4, VTK from CVS, Mesa 6.5 (compiled with mangling), everything
> compiled with xlC_r.  I've configured VTK with VTK_USE_MANGLED_MESA on,
> OPENGL_gl_LIBRARY set to /usr/lib/libGL.a, MANGLED_MESA_LIBRARY set to
> the Mesa lib I compiled, and MANGLED_OSMESA_LIBRARY set to the OSMesa
> lib I compiled.
>
> I can compile and run the attached program, and everything works fine.
> A window pops up, and a nice tiff file is created.  But if I run it with
> the "-os" option, the tiff file is just a black square.
>
> I've been working on this for days, searching the mailing list and
> trying different compile options, but to no avail.
>
> Any help would be greatly appreciated.
>
> Thanks!
> John
> --
> John Norris
> Research Programmer
> Center for Simulation of Advanced Rockets
> http://www.uiuc.edu/ph/www/jnorris
>
>
> #include <iostream>
> #include "vtkActor.h"
> #include "vtkConeSource.h"
> #include "vtkGlyph3D.h"
> #include "vtkGraphicsFactory.h"
> #include "vtkImagingFactory.h"
> #include "vtkPolyData.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkSphereSource.h"
> #include "vtkTIFFWriter.h"
> #include "vtkWindowToImageFilter.h"
>
> int main( int argc, char *argv[] )
> {
>   int os = (argc > 1 && strcmp(argv[1], "-os") == 0) ? 1 : 0;
>   if (os) {
>     vtkGraphicsFactory* gFactory = vtkGraphicsFactory::New();
>     gFactory->SetUseMesaClasses(1);
>     gFactory->Delete();
>     vtkImagingFactory* iFactory = vtkImagingFactory::New();
>     iFactory->SetUseMesaClasses(1);
>     iFactory->Delete();
>   }
>
>   vtkRenderer *renderer = vtkRenderer::New();
>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>     if (os)
>       renWin->OffScreenRenderingOn();
>     renWin->AddRenderer(renderer);
>   std::cout << "Using " << renWin->GetClassName() << std::endl;
>
>   vtkSphereSource *sphere = vtkSphereSource::New();
>     sphere->SetThetaResolution(8); sphere->SetPhiResolution(8);
>   vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
>     sphereMapper->SetInput(sphere->GetOutput());
>   vtkActor *sphereActor = vtkActor::New();
>     sphereActor->SetMapper(sphereMapper);
>
>   vtkConeSource *cone = vtkConeSource::New();
>     cone->SetResolution(6);
>
>   vtkGlyph3D *glyph = vtkGlyph3D::New();
>     glyph->SetInput(sphere->GetOutput());
>     glyph->SetSource(cone->GetOutput());
>     glyph->SetVectorModeToUseNormal();
>     glyph->SetScaleModeToScaleByVector();
>     glyph->SetScaleFactor(0.25);
>
>   vtkPolyDataMapper *spikeMapper = vtkPolyDataMapper::New();
>     spikeMapper->SetInput(glyph->GetOutput());
>
>   vtkActor *spikeActor = vtkActor::New();
>     spikeActor->SetMapper(spikeMapper);
>
>   renderer->AddActor(sphereActor);
>   renderer->AddActor(spikeActor);
>   renderer->SetBackground(1,1,1);
>   renWin->SetSize(300,300);
>
>   vtkWindowToImageFilter* w2if = vtkWindowToImageFilter::New();
>   w2if->SetInput(renWin);
>
>   vtkTIFFWriter* writer = vtkTIFFWriter::New();
>   writer->SetFileName("Mace.tiff");
>   writer->SetInput(w2if->GetOutput());
>
>   // interact with data
>   renWin->Render();
>   w2if->Update();
>   writer->Write();
>
>   // Clean up
>   writer->Delete();
>   w2if->Delete();
>   renderer->Delete();
>   renWin->Delete();
>   sphere->Delete();
>   sphereMapper->Delete();
>   sphereActor->Delete();
>   cone->Delete();
>   glyph->Delete();
>   spikeMapper->Delete();
>   spikeActor->Delete();
>
>   return 0;
> }
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>



More information about the vtkusers mailing list