Platform SDK: DirectX

Enabling and Disabling the Lighting Engine

[C++]

By default, Direct3D performs lighting calculations on all vertices, even those without vertex normals. (This is different from the behavior in previous releases of DirectX, where lighting was performed only on vertices that contained a vertex normal.) However, you can disable lighting through the D3DRENDERSTATE_LIGHTING render state. Call the IDirect3DDevice7::SetRenderState method, passing D3DRENDERSTATE_LIGHTING as the first parameter, and TRUE or FALSE as the second parameter. Setting the state to TRUE enables lighting (the default) and setting it to FALSE disables lighting operations.

If your application uses vertex buffers, the process is slightly different, but it's just as simple: include or omit the D3DVOP_LIGHT flag when calling the IDirect3DVertexBuffer7::ProcessVertices or IDirect3DVertexBuffer7::ProcessVerticesStrided methods to enable or disable lighting for that vertex buffer.

[Visual Basic]

By default, Direct3D performs lighting calculations on all vertices, even those without vertex normals. However, you can disable lighting through the D3DRENDERSTATE_LIGHTING render state. Call the Direct3DDevice7.SetRenderState method, passing D3DRENDERSTATE_LIGHTING as the first parameter, and True or False as the second parameter. Setting the state to True enables lighting (the default) and setting it to False disables lighting operations.

If your application uses vertex buffers, the process is slightly different, but it's just as simple: include or omit the D3DVOP_LIGHT flag when calling the Direct3DVertexBuffer7.ProcessVertices method to enable or disable lighting for that vertex buffer.