[vtkusers] offscreen rendering on linux

Cory Quammen cory.quammen at kitware.com
Wed Oct 8 08:35:17 EDT 2014


I don't see anything in your code that tries to enable offscreen
rendering. Can you add

renWin->OffScreenRenderingOn();

and give that a try?

Also, if you have built the VTK tests on linux, can you run

ctest -R vtkRenderingCoreCxx-TestOSConeCxx

That test does not show a window on my linux virtual machine that uses
Mesa for rendering. Let us know if that tests pops up a window for you
on linux with GPU-accelerated rendering.

Thanks,
Cory

On Wed, Oct 8, 2014 at 2:51 AM, Emptystack <wulihouxiaoshuai at 163.com> wrote:
> I have used the attached code to test offscreen rendering.I works well on
> windows os,but on linux a blank window will always appear.I have searched
> the relevant topics on the VTK forum,everyone  has different opinion,I have
> tried some methods but it failed. Has someone used the VTK to develop
> offscreen rendering and GPU accelerated rendering ? Can you give me some
> suggestions?
>
> Best wishes!
>
> The following is the test code :
>
>    vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();
>    dicomReader->SetDirectoryName("D:/image/SER25");
>    dicomReader->Update();
>
>   // Create the renderer, render window and interactor
>   vtkRenderer *renderer = vtkRenderer::New();
>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>   renWin->AddRenderer(renderer);
>
>   // Connect it all. Note that funny arithematic on the
>   // SetDesiredUpdateRate - the vtkRenderWindow divides it
>   // allocated time across all renderers, and the renderer
>   // divides it time across all props. If clip is
>   // true then there are two props
>   vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>   iren->SetRenderWindow(renWin);
>
>
>   // Create our volume and mapper
>   vtkVolume *volume = vtkVolume::New();
>   vtkSmartVolumeMapper *mapper = vtkSmartVolumeMapper::New();
>   mapper->SetInputConnection( dicomReader->GetOutputPort() );
>
>
>
>   // Create our transfer function
>   vtkColorTransferFunction *colorFun = vtkColorTransferFunction::New();
>   colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0 );
>   vtkPiecewiseFunction *opacityFun = vtkPiecewiseFunction::New();
>   opacityFun->AddSegment( -500 - 0.5*1500, 0.0, -500 + 0.5*1500, 1.0 );
>
>   // Create the property and attach the transfer functions
>   vtkVolumeProperty *property = vtkVolumeProperty::New();
>   property->SetIndependentComponents(true);
>   property->SetColor( colorFun );
>   property->SetScalarOpacity( opacityFun );
>   property->SetInterpolationTypeToLinear();
>
>   // connect up the volume to the property and the mapper
>   volume->SetProperty( property );
>   volume->SetMapper( mapper );
>
>
>   mapper->SetBlendModeToMaximumIntensity();
>
>
>
>
>   // Set the default window size
>   renWin->SetSize(600,600);
>   renWin->Render();
>
>   // Add the volume to the scene
>   renderer->AddVolume( volume );
>
>   renderer->ResetCamera();
>
>   // interact with data
>   renWin->Render();
>
>   iren->Start();
>
>   opacityFun->Delete();
>   colorFun->Delete();
>   property->Delete();
>
>   volume->Delete();
>   mapper->Delete();
>
>   renderer->Delete();
>   renWin->Delete();
>   iren->Delete();
>
>   return 0;
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/offscreen-rendering-on-linux-tp5729025.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list