Jump to content
  • Advertisement
Sign in to follow this  
3DModelerMan

Drawing with user pointers in DX10

This topic is 2838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!