This topic is now archived and is closed to further replies.


Question about Locking Vertex Buffers

Recommended Posts

I'm having a terrible time cloning a mesh and locking the vertex buffer so that I can add texture coordinates. All I'm doing at the moment is using the application wizard to generate a generic teapot application. After the teapot is created I'm trying to clone the mesh into an FVF that supports textures, this is working fine. But no matter which of the overloaded methods I use to try and lock the vertex buffer I either get an error. I've searched through the online docs as well as all of the sample programs with no luck. I have noticed that none of the sample programs lock the vb of a cloned mesh. Are cloned mesh's represented differently somehow? I'm at my wits end with this and would greatly appreciate any suggestions. If you would like to recreate, just create a generic teapot application and then replace the InitDeviceObjects with the following code you'll have exactly what I have at the moment. ---- begin code snippet ---- protected override void InitializeDeviceObjects() { drawingFont.InitializeDeviceObjects(device); Mesh temp = Mesh.Teapot(device); try { teapot = temp.Clone(MeshFlags.SystemMemory , CustomVertex.PositionNormalTextured.Format, device); } catch(Exception e1) { MessageBox.Show(e1.ToString()); } //Any attempt to lock and unlock the vertex //buffer here fails, regardless of which overload //is used. I have used different MeshFlags during //the above call to Clone() with no changes. } [edited by - l99057j on December 25, 2002 11:56:24 PM]

Share this post

Link to post
Share on other sites