Skip to main content
gamedev.net
🔒 Locked

VertexBuffer Access

Started by TheMaskedFace May 19, 2006 at 11:12 AM 1 replies 500+ views
Original Post
TheMaskedFace
TheMaskedFace
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.
wake up your sleepin' brains...
Evil Steve
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...
sirob
sirob
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 :).
Sirob Yes.» - status: Work-O-Rama.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.