Sign in to follow this  

Reading from a vertex buffer?

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

This topic is 4867 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.

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