Original Post
Hiya. As always, thanks for reading this. 1. I am currently disabling, resetting, and reenabling almost every light in a scene for every object in that scene, so that I can use up to MAX_LIGHTS per object in a scene, using a sort of bounding sphere collision detection to decide whether any given light is within range of any given object, so that only lights that will actually hit a given scene object are being used when that object renders, and ALL of the lights that hit that object will be used. The code works great but I'm wondering if all of these calls to SetLight and LightEnable are going to be extremely time consuming. Pseudocode: for every active light SetLight(x, FALSE); nActiveLights=0 for every scene object{ for every other scene object{ if every other scene object.Light.Range < every scene objects distance from that light SetLight(nActiveLights, &every other scene object.Light) LightEnable(nActiveLights, TRUE) nActiveLights++; } } My question is, are all of these repetitive calls to SetLight and LightEnable going to be extremely time consuming? I.e., what kind of overhead do these calls carry? 2. Can somebody point me in the direction of some good web resources on optimizing DX9 in general? Thanks again. Love this forum.