vtkLightActor crashes if the light is not positional
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
In the following demo, if
light->SetPositional(true);
is not called, the program crashes. With the above line, it does not crash and displays the light correctly.
#include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkLightActor.h> #include <vtkLight.h> #include <vtkSmartPointer.h> #include <vtkRenderWindowInteractor.h>
int main() { vtkSmartPointer renderer = vtkSmartPointer::New();
// Display where the light is vtkSmartPointer light = vtkSmartPointer::New(); // light->SetPositional(true); // without this line, the program crashes vtkSmartPointer lightActor = vtkSmartPointer::New(); lightActor->SetLight(light); renderer->AddViewProp(lightActor);
vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer);
vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->Render(); renderWindowInteractor->Start();
}