[Interest] [Qt3D] Set up a QDirectionalLight

Nye kshegunov at gmail.com
Sun Dec 6 09:12:02 CET 2015


Hello,
How one goes about setting a light source for a scene? I tried by creating
a QDirectionalLight and adding it as a component to my mesh/root node, but
it doesn't show. Is this part of the Qt3D implemented, or is it just an
interface for now?

Here is the a sample code I'm using:

Qt3D::QDirectionalLight * light = new Qt3D::QDirectionalLight();

light->setColor(Qt::red);

light->setDirection(QVector3D(0, -1, 0));

light->setEnabled(true);


lamp->addComponent(mesh);

lamp->addComponent(material);

lamp->addComponent(transforms);

lamp->addComponent(light);

Also I'm getting a weird message in the debug
window:Qt3D::QDirectionalLight::setProperty: Property
"positionTransformed" invalid, read-only or does not existThanks in
advance.
Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151206/b8bf49a7/attachment.html>


More information about the Interest mailing list