Original Post
Okay, I''m new to this whole Direct3D thing, but I have a question that I think is important before doing any architecting.
Conceptually, just about any game written for D3D is going to be object oriented, and I assume that each object is going to draw itself.
My question is: how do you manage render states? Do all of your onscreen objects use the exact same render states? If not, how does each class object know which render states to change when before drawing itself? It seems that it would be a waste for each class object to set each of the bajillion render states before drawing itself. But that''s going to be the only way, ultimately, that the class object is going to "know" that the device is in the correct render state.
Currently, the only idea I have is this: when I create an instance of my class object, I would pass it a complete "default" render state. My game code would guarantee that the device will always be in this state when I call the class'' Render() method. The class, then, would only call SetRenderState() for the attributes that are different between the default render state and the render state it needs. (It would then, of course, set the render state back to the default before exiting Render()).
I''m just curious to know how others handle this.