tags:

views:

83

answers:

1

In a Direct3D application (managed), should I recreate the vertex buffer every time I lose my device?

The application I am developing is a windows CAD application. Not a game. I was thinking I could generate the vertex buffer when my 3D Model changes. But should I redo it when I lose my device or can I reuse the vertex buffer from the old device?

+2  A: 

If you have to recreate your vertex buffer depends in which pool you have created them.

Vertes buffers that reside in the D3DPOOL_MANAGED pool will be automatically recreated by directx. Buffes in system memory don't get lost so you don't have to recreate these either.

Only buffers that reside entirely in the video-memory need to be recreated as the content of the video memory gets lost each time you loose the device.

I suggest that you just use the managed pool for all your static objects. That increases the memory requirement a bit but you don't have to care about the pesky details such as running out of video memory, lost buffer recreation ect.

Nils Pipenbrinck