Sign in to follow this  
schupf

Is a VertexBuffer always readable?

Recommended Posts

schupf    221
I have a class Mesh, that holds a VertexBuffer and now I want to lock the vertex buffer to calculate the bounding box of the mesh. I wonder if it
is ALWAYS possible to lock a VertexBuffer for reading.
As you know there are several options for DX9 vertex buffers (Static, Dynamic, DEFAULT Pool, Managed Pool etc.).

Can I lock EVERY vertex buffer for reading regardless of the used options?
Even a vertex buffer that has been created with flag D3DUSAGE_WRITEONLY (and locked with lock flag 0)?

Share this post


Link to post
Share on other sites
kauna    2922
[color=#1C2837][size=2]
[color=#1C2837][size=2]
[/size][/color]
[color=#1C2837][size=2]Hi,[/size][/color]
[color=#1C2837][size=2]
[/size][/color]D3DUSAGE_WRITEONLY means that you can't read from the buffer.[/size][/color]
[color=#1C2837][size=2]
[/size][/color]
[color=#1C2837][size=2]So, usually you can't read from the buffers unless specified at creation time.[/size][/color]
[color=#1C2837][size=2]
[/size][/color]
[color=#1C2837][size=2]I'd keep copy of the data for the bound box calculations.[/size][/color]
[color=#1C2837][size=2]
[/size][/color]
[color=#1C2837][size=2]Cheers![/size][/color]

Share this post


Link to post
Share on other sites
schupf    221
Well, but even if I create the buffer with usage flag D3DUSAGE_WRITEONLY, I can lock the vertex buffer with flag 0:

[code]
g_pVertexBuffer->Lock( 0, sizeof(g_quadVertices), (void**)&pVertices, 0 );
[/code]
Nothing can prevent me from reading from pVertices now. Or did I miss something?

Share this post


Link to post
Share on other sites

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