Jump to content
  • Advertisement
Sign in to follow this  
dave

Reading from a vertex buffer?

This topic is 5171 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 realised im getting a performance hit when every frame i drw from a different vertec buffer for like 100 quads, so i gather that if i want to put all the contents of the separate VBs into 1 VB i would have to read and copy the data accross somehow. Any hints and tips on how to do this? DirectX BTW [EDIT] - Also if anyone could explain to me how to index through the vertex buffer when rendering, so i could then apply the appropriate texture to each quad, i would be most grateful, ace

Share this post


Link to post
Share on other sites
Advertisement
How about instead of loading each separate buffer at initialization, you load the big one instead, if that's what you are trying to achieve.

To read from vertex buffers, just lock them with the D3DLOCK_READONLY flag, then the pointer you locked the buffer with will contain the data.


VERTEX_STRUCT *Data;
pBuffer->Lock(0, 0, (void**)&Data, D3DLOCK_READONLY);
SomeOtherData = Data->Position;
// etc...
pBuffer->Unlock();



Chris

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!