Sign in to follow this  
CPPNick

Scene management

Recommended Posts

hello again!~ I have to thank everyone again for the help getting me started on directx. I have just finally worked through all the basic msdn tutors, and not I'm ready to move on to the next step. I have a couple of questions that I am having a hard time dealing with, and if someone can give me a few pointers, or recommend a book that has these answer, it would be much appreciated!(Im lazy so answers>books =) lol but Ill take what I can get. I have a simple project, with mouse and keyboard input to move and look around a room with one point light in it. I want to add some more objects to it and do collision detection now. Can someone tell me the best structure for handling multiple objects in directx? Do I create a different vertex and index buffer for each object, or stick everything in one? Right now I have only one vertex buffer, and one index buffer, and I am using "D3D10_SUBRESOURCE_DATA" to input initial data to be used throughout the scene. I then call dxdevice->DrawIndexed(36, 0, 0); once per scene to render the room. I don't see how this format will allow for multiple objects with separate textures in a practical way =/ If anyone could recommend a book, or just link me to something that has an example of this, it would be really helpful. thanks for any help.

Share this post


Link to post
Share on other sites
There's an article here at gamedev that might be of some help to you, although it is rather naive about how we do vertex buffers in OpenGL (from reading it, you'd think we stick one triangle in a buffer then send it off).

Going by my own naive assumption that "vertex buffers aren't that much different in DirectX", you'll want to have multiple buffers. Yann L has some posts in certain threads of this forum that discuss various cache management strategies. NVidia once recommended something like 1MB to 4MB size per vertex buffer for OpenGL; it might be similar to DirectX. You don't want to make them too large or the driver won't be able to handle them efficiently, but at the same time you won't get much benefit out of using very small buffers since switching buffers costs time.

Share this post


Link to post
Share on other sites
Thanks for the link, but I'm using directx 10 in this project..I know the theory is similar, but aside from it being the wrong version, I found that tutorial very complicated...

I just need a simple tutorial about how to organize and render multiple objects/meshes in directx 10

Share this post


Link to post
Share on other sites
Does anyone have a link to a better or more simple tutorial on vertex buffers? I need something to help me create a dynamic vertex buffer, and organize two or three separate objects. Each object will have its own texture, and its own list of vertices and indices.

Share this post


Link to post
Share on other sites
you know...someone could have just told me to read the intructions..
:P the answer was on like...the second page..lol

and! that's not a given anymore these days you know..with all the wizards and "Next" buttons..LOL

Share this post


Link to post
Share on other sites
I can just use multiple vertex buffers, one for each object right? I think I read I can have a total of 4096 buffers or something..one vert buffer for each object or group of small objects could be made efficiently no?

Share this post


Link to post
Share on other sites
Sure, you can but you probably shouldn't. I allocate a number of 1 MB buffers and fill them as required. You can easily have geometry with different vertex formats in a single buffer, so there's no real reason not to share them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this