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)?
Is a VertexBuffer always readable?
[color=#1C2837][size=2]
[color=#1C2837][size=2]
[color=#1C2837][size=2]Hi,
[color=#1C2837][size=2]
D3DUSAGE_WRITEONLY means that you can't read from the buffer.
[color=#1C2837][size=2]
[color=#1C2837][size=2]So, usually you can't read from the buffers unless specified at creation time.
[color=#1C2837][size=2]
[color=#1C2837][size=2]I'd keep copy of the data for the bound box calculations.
[color=#1C2837][size=2]
[color=#1C2837][size=2]Cheers!
[color=#1C2837][size=2]
[color=#1C2837][size=2]Hi,
[color=#1C2837][size=2]
D3DUSAGE_WRITEONLY means that you can't read from the buffer.
[color=#1C2837][size=2]
[color=#1C2837][size=2]So, usually you can't read from the buffers unless specified at creation time.
[color=#1C2837][size=2]
[color=#1C2837][size=2]I'd keep copy of the data for the bound box calculations.
[color=#1C2837][size=2]
[color=#1C2837][size=2]Cheers!
Well, but even if I create the buffer with usage flag D3DUSAGE_WRITEONLY, I can lock the vertex buffer with flag 0:
Nothing can prevent me from reading from pVertices now. Or did I miss something?
g_pVertexBuffer->Lock( 0, sizeof(g_quadVertices), (void**)&pVertices, 0 );
Nothing can prevent me from reading from pVertices now. Or did I miss something?
Your driver might stop you from doing it. And - worse - it may work on one driver but crash horribly on another. So don't do it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement