Sign in to follow this  

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

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

[code]
// 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);[/color] // 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();[/code]

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

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