views:

31

answers:

1

Given an instance of IDirect3DDevice9, what approaches are available to put it in its original render state (i.e. the state it was in when the device was initially created)?

The cleanest way that I've come across is to create a state block via IDirect3DDevice9::CreateStateBlock just after the device has been created so that it can be applied later. Unfortunately, I'm operating under the constraints of an existing project such that I can't modify the device creation code; by the time my component gets the device, its default state has been modified. As a result, I'm looking for alternative approaches.

Thx! ~Raf

+1  A: 

Well there is no way to be 100% sure. The driver often fails to put things into a default state. Most software will set up its own default state to avoid suffering such problems from the driver.

You "could" however rely on the fact that the driver does what it is supposed too. You can then read through the docs and set all the render states to the, supposed, default value.

There is no other way to do this.

Goz