[vtkusers] Bug?:5.4.0 performance versus 5.0
Jon Waite
JonW at pathsurg.com
Tue May 12 09:41:04 EDT 2009
Hack. If I force the use of the old vtkOpenGLPolyDataMapper I can get
around the problem but of course I am not then using the new painting
mapper of vtk 5.4.0.
On Mon, May 11, 2009 at 1:40 PM, Jon Waite <JonW at pathsurg.com> wrote:
> Hello,
>
> When rendering an actor with >50,000 points with scalars on, and
> transparency < 1, 5.4.0 renders < 1 fps versus the same code linked to
> vtk 5.0 which performs normally. Attached is the example code, if run
> against each library, the bug is portrayed.
>
> Thanks,
> Jon
>
> ----------------------------------
>
> // VtkScalarBug.cpp : Defines the entry point for the console application.
> //
>
> #include "stdafx.h"
>
> #include "vtkRenderWindowInteractor.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkActor.h"
>
> #include "vtkPolyDataMapper.h"
> #include "vtkLookupTable.h"
> #include "vtkCamera.h"
>
> #include "vtkWin32OpenGLRenderWindow.h"
> #include "vtkWin32RenderWindowInteractor.h"
>
> #include "vtkProperty.h"
> #include "vtkPolyDataReader.h"
> #include "vtkFloatArray.h"
> #include "vtkPointData.h"
> #include "vtkPlaneSource.h"
> #include "vtkSphereSource.h"
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> vtkWin32OpenGLRenderWindow *renWin = vtkWin32OpenGLRenderWindow::New();
> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
> iren->Initialize();
>
> vtkRenderer *renderer = vtkRenderer::New();
> renWin->AddRenderer(renderer);
> if(1)
> {
> if (1)
> {
> vtkSphereSource* sphere = vtkSphereSource::New();
> const int res = 500;
> sphere->SetPhiResolution(res);
> sphere->SetThetaResolution(res);
> sphere->Update();
> const double setval = 0.8;
>
> vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
> mapper->SetInput(sphere->GetOutput());
> sphere->Delete();
>
> mapper->SetScalarRange(0,setval);
>
> vtkLookupTable* lut = vtkLookupTable::New();
> lut->SetNumberOfColors(2);
> lut->Build();
> lut->SetTableValue(1,setval,0,0);
> lut->SetTableValue(0,setval,setval,setval);
>
> mapper->SetLookupTable(lut);
> lut->Delete();
>
> vtkPolyData* SpherePoly = mapper->GetInput();
>
> int NumLiverPoints = SpherePoly->GetNumberOfPoints();
> vtkFloatArray* scalars = vtkFloatArray::New();
> const int fullrange = 50;
> const int half = fullrange/2;
> for (int i=0;i<NumLiverPoints;i++)
> {
> scalars->InsertTuple1(i,(i%fullrange)>half?0:setval);
> }
> SpherePoly->GetPointData()->SetScalars(scalars);
> scalars->Delete();
> SpherePoly->Modified();
>
> vtkActor* cubeA = vtkActor::New();
> renderer->AddActor(cubeA);
> cubeA->SetMapper(mapper);
> cubeA->GetProperty()->SetOpacity(0.5);
> mapper->Delete();
> cubeA->Delete();
> }
>
> renderer->ResetCamera();
> renderer->Render();
> }
>
> iren->Start();
>
> renderer->Delete();
> renWin->Delete();
> iren->Delete();
>
> return 0;
> }
>
More information about the vtkusers
mailing list