[vtkusers] Issues in creating Positional vtkLight

Remi Charrier remi.charrier at gmail.com
Mon Jul 11 08:54:01 EDT 2016


Hi all,

I am trying to create a positional vtkLight (without having necessary the
spotlight (vtkLightActor)) and I have troubles with the function:
setPositional when setting it to 1 it makes my rendering crashes without
clear message when I add the light to the renderer.

Indeed, I never managed to have simultaneously the lightning generated by
the vtkLight and the vtkLightActor allowing me to visualize the position of
the light.

Here is a piece of my code:

vtkSmartPointer<vtkLight> light = vtkSmartPointer<vtkLight>::New();
*light->SetPositional(1);*
light->SetPosition(-15, 21, 5);
light->SetLightTypeToSceneLight();
light->SetFocalPoint(m_FocusPoint[0], m_FocusPoint[1], m_FocusPoint[2]);
light->SetColor(1, 1, 1.0);
light->SetIntensity(1));
light->SetConeAngle(angle);
light->SetSwitch(true);


if (m_SpotLightsVisible == false)
{
*m_Renderer->AddLight(m_LigthsCollection[i]);*
}
if (m_SpotLightsVisible == true)
{
vtkSmartPointer<vtkLightActor> lightActor =
vtkSmartPointer<vtkLightActor>::New(); lightActor->SetLight(*light*);
m_Renderer->AddViewProp(lightActor);

m_Renderer->Render();

std::cout << "ligth can not be added when using spots ligths..." <<
std::endl;
}
}

Let me know if you need more information to understand what it is going on
with my lights.
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160711/559f92d2/attachment.html>


More information about the vtkusers mailing list