Drawing with user pointers in DX10

Started by
0 comments, last by MJP 13 years, 1 month ago
I need to write a function that takes a line's start point, and end point. And draws that, but DirectX10 doesn't have a draw primitive function that takes user pointers (at least as far as I can tell). How could I implement this and similar functions like it (draw bounding box, etc)? Would it be bad to have a dynamic vertex/index buffer that I keep locking and modifying each call to the draw? To use as a temporary vertex buffer? Or maybe creating vertex buffers on demand, drawing, and then releasing?
Thanks for any help.
Advertisement
Having a dynamic buffer is probably the way I would do it. You can just make one of a rather large size, and keep modifying it. If you keep track of how much data you've written into it each frame, then you can use D3D10_MAP_WRITE_NO_OVERWRITE which should make the mapping pretty efficient. So basically the first time you map it each frame you use D3D10_MAP_WRITE_DISCARD to discard all of the previous frame's data, then for each subsequent map you use D3D10_MAP_WRITE_NO_OVERWRITE.

I wouldn't recommend constantly creating and releasing resources...doing this can be very slow. You might be able to make it work if you cache your pool of vertex/index buffers, and then each time you need to draw look through to cache to see if a suitable buffer is available.

This topic is closed to new replies.

Advertisement