Jump to content
  • Advertisement
Sign in to follow this  
TheMaskedFace

VertexBuffer Access

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

When I have compiled my project I get an error about Access Violation Error. I do not know the cause of this, but I think it is because of the vertexbuffer. I have a code like that.What I want to do is,just to create boundry objects of my models.
 vertexBufferBD[range] = new VertexBuffer(mesh.SourceMesh.VertexFormat.GetType(),
                                             boundryVertices.Length, modelDevice,
                                             Usage.WriteOnly,
                                             mesh.SourceMesh.VertexFormat,
                                             Pool.Default);
            vertexBufferBD[range].SetData(boundryVertices, 0, LockFlags.None);
            vertexBufferBD[range].Unlock();

          
            GraphicsStream graphicsBuffer = vertexBufferBD[range].Lock(0, 0, LockFlags.None);
            radius = Geometry.ComputeBoundingSphere(graphicsBuffer, vCount, mesh.SourceMesh.VertexFormat, out objectCenter);
                


So,does anyone help to solve my problem?I will be very happy,if so.

Share this post


Link to post
Share on other sites
Advertisement
At a guess, I'd say that it's because you create your vertex buffer as write only, but then read from it. Aside from that, are you sure the lock succeeds? I don't know how you test this in MDX...

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
At a guess, I'd say that it's because you create your vertex buffer as write only, but then read from it. Aside from that, are you sure the lock succeeds? I don't know how you test this in MDX...


Sounds right. In MDX, if a call fails, it would throw an exception, so at least the problem of calls "silently" failing doesn't exist :).

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!