Code from the pipeline of MDI appllication which worked with 5.8. Need help upgrading it to 9.1

Hi Everyone,
I am working on a project which includes following code. This code was developed in vtk5.8 and now I am trying to make it work in vtk9.1. The code is compiling but it is not rendering anything. Can Anyone look at the code and let me know any specific reason.

this->ren = vtkRenderer::New();
this->renWin = vtkWin32OpenGLRenderWindow::New();
this->iren = vtkWin32RenderWindowInteractor::New();
this->Actor = vtkActor::New();
this->ren->AddActor(this->Actor);
this->renWin->AddRenderer(this->ren);
this->iren->SetRenderWindow(this->renWin);

vtkPolyData* data = vtkPolyData::New();
vtkCellArray *polys = vtkCellArray::New();
vtkPoints *newPts = vtkPoints::New();

Internal code to fill newpts and polys with data is working fine*

data->SetPoints(newPts);
data->SetPolys(polys);
pMapper->SetInputData(data);
this->Actor->SetMapper(mapper);
this->ren->SetBackground(0.0, 0.0, 0.0);
this->ren->SetAmbient(1.0, 1.0, 1.0);
this->ren->RemoveAllViewProps();
this->renWin->Render();

Why are you explicitly instantiating the derived classes vtkWin32OpenGLRenderWindow and vtkWin32RenderWindowInteractor? Why are you not using vtkRenderWindow and vtkRenderWindowInteractor? Also, “RemoveAllViewProps()” sure looks suspicious to me…

I am working on a MFC application that’s why I am using these.


void vtkViewport::RemoveAllViewProps ( void 
 ) 
 
 

>  > <br><br>Remove all actors from the list of actors.<br><br> |
> - | - |

https://vtk.org/doc/release/5.0/html/a02171.html#z1488_0

I don’t think you want to do that! Also check to make sure you are using the correct type of mapper - pMapper in your code.

pMapper is a DataSetMapper.