Sign in to follow this  

Is a VertexBuffer always readable?

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

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
[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
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

This topic is 2338 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.

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