Archived

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

JonnyBoy

VB's and stuff

Recommended Posts

OK I load my world, and store it in vertex and index buffers. Now, I also want to use my mesh for collision detection. So, should I be looking to maintain two meshes - one held in VB''s for rendering, and one held in sys ram for collision detection ? Or is it OK to keep locking and unlocking VB''s. Does locking and unlocking incure speed hits, and if so how much, etc ? One would assume that if the VB is held in GFX RAM, then the LOCK would actually forse it to be copied to sys ram, etc, which would be a nightmare. But then at the same time, maintaining two meshes is crazy! Thanks for you help.

Share this post


Link to post
Share on other sites
No, not at all. If you pre-calc, and merge as much data as possible, loading doesn''t take long. Loading times on PC games are a sin and are the result of lazy programmers. Seriously, sometimes I just can not work out how they have managed to make something take so long. You''d get shot for programming like that on a console!

So if I don''t need it in system ram I will load it back in when I do.

This is the same for textures also. Currently I do not keep a copy of my textures, or mesh in system ram. I reload on a resize or page flip, and this currently takes hardly anytime (fraction of second). My mesh is pre-prepared so I do not perform computations on it when I load, and my textures are joined to create one big file to save on seeks and sector round-ups (16k)per file. To look at this in the extreme case if you had 100 1k textures, with my system you would stream 100k in in one go, with individual files we''re talking 1600k with 100 seeks and reads.

Besides, I really do not expect people to keep alt-tabbing in and out of my game. It''s a game not a database.

However, if it is too slow to lock and unlock VB''s, I will have no choice but to keep a second copy.

Share this post


Link to post
Share on other sites