Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

OpenGL How to call D3D9 VB and IB by Index?

This topic is 969 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

Like in OpenGL, I don't want to bind the vbs and ibs during render calls?

I want to bind them in advance.

BTW, if I got a std::vector of vertexes and tie them to BYTE** which points to this VB or IB,

when this vector of vertexes change, will the vb and ib change accordingly as well?

Thanks

Jack

Share this post


Link to post
Share on other sites
Advertisement

Like in OpenGL, I don't want to bind the vbs and ibs during render calls?
I want to bind them in advance.

Direct3D does not work this way, nor does the actual hardware. Why the GL people thought this was a good idea, I have no clue. In all the other APIs, the vertex declaration/input layout is separate from the actual buffers in use. Changing the vertex structure is (potentially) very expensive, while changing the attached buffers is pretty much free.

 


BTW, if I got a std::vector of vertexes and tie them to BYTE** which points to this VB or IB,
when this vector of vertexes change, will the vb and ib change accordingly as well?

Absolutely not. You must Lock the VB/IB and update the data manually.

Edited by Promit

Share this post


Link to post
Share on other sites

My program went extremely slow because of the number of vertexes and indices I pass over to the renderer in every frame call.

Like 10000 vertexes and 30000 indices in every call.

In every frame past, I need to build the vb and ib all over again, the renderer gradually builds up

the vertex buffer and index buffer by iterating them one by one, if this is done by software.

And I have other stuff to do during the frame elapsed, if the renderer engaged in dealng with the buffers,

the performance will suffer. Are there any optimizations I can consider?

Thanks

Jack

Share this post


Link to post
Share on other sites

Are there any optimizations I can consider?


Does the data you're pushing to the GPU need to change every frame?  If not, then don't change it.

 

Otherwise you'll need to talk a little more about how you're updating those buffers.  Are you using dynamic buffers with the no-overwrite/discard pattern or not?

Share this post


Link to post
Share on other sites

I am using the Smartbody library.

The final transformation of every vertex is reflected in a position buffer at the end of every update call.

I then have to bind them to the vertex buffer and render away.

I think the usual way is to give a transformation to the whole mesh/bone, the library seems to be vertex perfect and processing

all vertexes in a total manner.

Maybe I oversee some of the features of the library so that I don't have to process all the vertexes entirely,

and just give a transformation to each submesh instead?

Thanks

Jack

Share this post


Link to post
Share on other sites

So Smartbody is tranforming the individual mesh vertices on the CPU ?  The usual way is like you suggested via a bone transforming aka.skinned mesh/skinning. So I'd be surprised if the library doesn't generate some for of transform data use to do the actual vertex transformation. If that information is available along with the weights, then I would suggest uploading those per frame instead of the entire mesh. Are the meshes growing in size ? If not, why would you need to re-upload the index buffer each frame ?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!