directional light question.

I am so lost for creating the lighting in game.
Any help will be great. Thank you!

window->set_lighting(true);

PT(DirectionalLight) MyLight = new DirectionalLight("Lighting"); 
MyLight->set_point(LPoint3f(0, 0, 10));
MyLight->set_direction(LVector3f(0, 0, 0));
MyLight->set_color(Colorf(255, 255, 255, 255));

NodePath NodePathLight = window->get_render().attach_new_node(DCAST(PandaNode, MyLight));
window->get_render().set_light(NodePathLight, 0);

There’s error for this line of code

window->get_render().set_light(NodePathLight, 0);

‘NodePath::set_light’ : cannot convert ‘this’ pointer from ‘const NodePath’ to ‘NodePath &’

Thank you!

Try this variant:

NodePath render = window->get_render();
render.set_light(NodePathLight, 0);

David

thankz. That solve the error.