device.Reset() problems

Started by
1 comment, last by barakus 18 years, 10 months ago
I'm getting an InvalidCallException when I try to use device.Reset, and having trouble figuring out why. To test it I created a simple application that just creates a vertex buffer with 3 vertices in it. I found that if I draw the vertex buffer in my render loop using the code:

device.SetStreamSource(0,vb,0);
device.VertexFormat=CustomVertex.PositionColoredTextured.Format;
device.DrawPrimitives(PrimitiveType.TriangleList,0,1);

then the exception happens, but otherwise everything is fine. Does anyone know how drawing it would make a difference as to whether the device can reset?
--------------Trans2D - 2D library for C# / Managed DirectX
Advertisement
Are you releasing the vertex buffer before you call reset? You need to release all video memory objects, call reset, then restore them. You have to release video-device type objects, even if they are totally stored in system memory.
Alternatively, you could create all your resources in the managed pool.

This topic is closed to new replies.

Advertisement