We've Got Camera and Action; What About Lights?

Now that we've got our single triangle drawn and spinning around, what else could make it even better? Why, lights of course! We mentioned lights briefly before, when our triangle turned completely black after we first moved over to our nontransformed triangles. Actually, we completely turned the lighting off in our scene. The first thing we need to do is to turn that back on, so change the lighting member back to true:

device.RenderState.Lighting = true;

You could just delete the line entirely since the default behavior for the device is to have lighting on; we'll just leave it as true for the sake of clarity. Running the application now, we see we're back to the black triangle again; it's just ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.