Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Filling Vertex Buffers with custom structures...

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

ive got a custom structure struct Terrain_Chunk { sVertex Terrain_Section[4]; // For VB DWORD Terrain_Section_ID[4]; // For IB bool Viewable; // For Culling } and i have an array: Terrain_Chunk Terrain_Data[X]; is there any way i can fill a vertex buffer with the entire arrays Terrain_Section component? the usual memcpy(pVertBuff,Stuff_To_Copy,sizeof(Stuff_To_Copy)); call will be no good in this instance from what i can see as there is no offset so im guessing this function if called multiple times would just overwrite the current data within this VB... thanks to anyone who can help or has any nice ideas...

Share this post

Link to post
Share on other sites
You can copy to anywhere in the buffer. Something like this:

sVertex * pBuffer;
pVB->Lock( ..., &pBuffer, ... );
for ( int i = 0; i < X; i++ )
memcpy( pBuffer, Terrain_Data[ i ].Terrain_Section, sizeof( sVertex ) * 4 );
pBuffer += 4;

Share this post

Link to post
Share on other sites

  • 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!