Archived

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

TeeCee

Dynamic Vertex Buffer confusion!

Recommended Posts

Hi all, I just wondered if anyone out there could help me with a question re. dynamic Vertex Buffers: If I have an object (say, a cube) whose vertices are held in a Vertex Buffer,and it is moving around in my game world, does this mean I need a dynamic Vertex Buffer? Or do I simply move the cube around using its own transform matrix, which I then set as the world matrix when needed? If this is the case, then the only reason I can see for having dynamic VB''s is if the object''s vertices change relative to one another (i.e. being deformed / changing shape etc). Is this correct? I would be sooo grateful if anybody could shed some light on the subject. Thanks, Tony.

Share this post


Link to post
Share on other sites
I never heard the term "Dynamic Vertex Buffer".What about it?
As anyone can just see the movement of the cube in world coordinate(view coordinate) but the local coordinate.It is not necessary to use dynamic vertex buffer I think.

goddess just one...

Share this post


Link to post
Share on other sites
A dynamic vertex buffer is one that can be constantly locked and reloaded with new vertex data as your application processes. A static vertex buffer is one that you set once with vertex data and resuse the same data during the course of your application.
Dynamic vertex buffers are great for drawing a large amount of polygons that change. If you have a single object that will never change, then use a static buffer - the static buffer is faster if used in hardware.

Jim Adams

Share this post


Link to post
Share on other sites
Jim,
when you say "polygons that change", do you mean ploys that change shape (i.e. deform) as opposed to polys that simply move around (rotate, translate etc.)
Tony.

Share this post


Link to post
Share on other sites
I should have worded that better It''s not really the same polygons that have to be drawn, any polygon can be drawn. One frame, you can draw a thousand colored polygons (of any mix of colors) and the next frame you can add a 100 colored polygons and 200 textured polygons. There''s not consistancy required.

Jim Adams

Share this post


Link to post
Share on other sites
Oh, so dynamic really refers to the buffer itself rather than dynamic objects, is that correct?
i.e. the actual contents of the buffer keep changing (?)

Share this post


Link to post
Share on other sites
I think "dynamic" means that you can replace the data or add data to it by use the D3DLOCK_DISCARD or D3DLOCK_NOOVERWRITE flags of lock() method.

I explain it in my mind are following:
If use D3DLOCK_DISCARD flag then D3D will assign a new pointer to the buffer and discard the data in it.If use D3DLOCK_NOOVERWRITE flag then D3D will hold the pointer then let you add data to it.

If use static vertex buffer then you can only fill it once.

Is it a right explain?

goddess just one...

Share this post


Link to post
Share on other sites
I think you''re right - the DX docs say that "The D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE flags are valid only on buffers created with D3DUSAGE_DYNAMIC".

Share this post


Link to post
Share on other sites