• Advertisement
Sign in to follow this  

[SlimDX] Failed to lock driver vertex buffer when loading models

This topic is 2468 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 can't figure out why the app is having trouble locking the vertexbuffer. Here is my code snippet.


// is this necessary?
if (vertexBuffer != null)
{
if (!vertexBuffer.Disposed)
{ vertexBuffer.Dispose(); }
}

vertexBuffer = new VertexBuffer(Device, VertexPositionNormalTextureColorTangent.SizeInBytes * vertexCount, Usage.WriteOnly, SlimDX.Direct3D9.VertexFormat.None, Pool.Default);

[color="#FF0000"] DataStream dataStream = vertexBuffer.Lock(0, 0, LockFlags.None); // exception is raised while attempting to lock vertexbuffer
foreach (List<VertexPositionNormalTextureColor> vlist in verticesNmTxCollst)
{
foreach (VertexPositionNormalTextureColor vertex in vlist)
{
dataStream.Write<VertexPositionNormalTextureColor>(vertex);
}
}

vertexBuffer.Unlock();


I have plenty of system memory available, this happens randomly when loading models. there are no d3d leaks or warnings showing.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement