Dynamic vertex buffers
Sorry if this is a dumb question but I was reading last night that a dynamic vertex buffer is one who's contents can be discarded when you lock it and is thus faster to lock. This looks like what I need since I am regenerating all the vertex information each frame (for 2D sprite quads).
Is this what you get when you specify the WRITE_ONLY flag to CreateVertexBuffer or is it more complicated?
Ta.
For a dynamic vertex buffer you have to use D3DUSAGE_DYNAMIC. But for optimal performance you should add D3DUSAGE_WRITEONLY too.
Dynamic vertex buffers are the only buffers that support the D3DLOCK_DISCARD flag. This flag tells the driver to throw away all the contents of the old buffer, and give you a new one. As such, it's relatively quick compared to some of the other lock types.
Specifying WRITE_ONLY tells the driver you'll only be writing to the buffer, and never reading from it.
[EDIT] bleh, 7 minutes... you even managed to say thanks before I even posted :(.
Specifying WRITE_ONLY tells the driver you'll only be writing to the buffer, and never reading from it.
[EDIT] bleh, 7 minutes... you even managed to say thanks before I even posted :(.
Well, thanks anyway [smile].
So to clarify, I just pass D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY to CreateVertexBuffer8, then I have an optimal buffer for regenerating all the vertex information each frame?
(PS: Using 8 because I am Borland-Boy and I can't get proper library conversions for 9 by the way.)
So to clarify, I just pass D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY to CreateVertexBuffer8, then I have an optimal buffer for regenerating all the vertex information each frame?
(PS: Using 8 because I am Borland-Boy and I can't get proper library conversions for 9 by the way.)
Quote:Original post by EasilyConfused
Well, thanks anyway [smile].
So to clarify, I just pass D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY to CreateVertexBuffer8, then I have an optimal buffer for regenerating all the vertex information each frame?
You also need the D3DLOCK_DISCARD when locking.
Quote:(PS: Using 8 because I am Borland-Boy and I can't get proper library conversions for 9 by the way.)
Why oh why? :)
Quote:Original post by ET3D
You also need the D3DLOCK_DISCARD when locking.Quote:(PS: Using 8 because I am Borland-Boy and I can't get proper library conversions for 9 by the way.)
Why oh why? :)
D3DLOCK_DISCARD - gotcha, cheers.
And in answer to your other very valid question, I only have 98SE at home and unfortunatley Microsoft have altered all their free compilers so they need 2000 or later to install.
Please believe me - I would like nothing more than to be using Visual C++. I've got a 500mhz P3 so probably would run 2000 or XP okayish but I only have a 5 gig hard drive at the moment.
I promise to buy a new hard drive soon and upgrade my OS so you all stop laughing at me but bl**dy fridge freezer broke down last night and just had to fork out £200 for a new one so not this month.
Wandering off topic a bit. [smile]
Quote:Original post by Demirug
Additional a dynamic vertex buffer needs to create in the default pool.
Is that with D3DPOOL_MANAGED?
Quote:Original post by EasilyConfusedthe default pool is D3DPOOL_DEFAULT [smile]Quote:Original post by Demirug
Additional a dynamic vertex buffer needs to create in the default pool.
Is that with D3DPOOL_MANAGED?
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement