I will add that when I use CView from the Code Project example the line
m_pvtkMFCWindow = new vtkMFCWindow(this);
does not result in an exception, but this line has an exception:
this->Context->GetDevice()->SetViewportSize(vtkVector2i(size));
vtkContext2D::GetDevicevirtual returned nullptr.
it is in the function vtkContextActor::RenderOverlay(vtkViewport* viewport).
Do I need to set the device or initialize other members in CTestBMPView::OnInitialUpdate()?
The example from code project just does the following:
m_pvtkMFCWindow = new vtkMFCWindow(this);
m_pvtkMFCWindow->GetRenderWindow()->AddRenderer(m_pvtkRenderer);
m_pvtkRenderer->SetBackground(0.0, 0.0, 0.0);
if(NULL != GetDocument()->m_pvtkBMPReader)
{
//setup renderer
m_pvtkImageActor->GetMapper()->SetInputConnection(GetDocument()->m_pvtkBMPReader->GetOutputPort());
m_pvtkRenderer->AddActor(m_pvtkImageActor);
m_pvtkRenderer->ResetCamera();
}