Re: Simple Example of Mesh.Sphere
From: Achim Domma (Procoders) (domma_at_procoders.net)
Date: 10/17/04
- Next message: Just Me: "How to use the Samples framwork"
- Previous message: Jarred Nicholls: "Re: VertexBuffer"
- In reply to: Achim Domma (Procoders): "Simple Example of Mesh.Sphere"
- Next in thread: akuehn: "Re: Simple Example of Mesh.Sphere"
- Reply: akuehn: "Re: Simple Example of Mesh.Sphere"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 17 Oct 2004 20:56:46 +0200
Ok, I'm one step further. I have to clone the mesh and set the colors of
the vertices. But doing that I have another problem. Here is my code:
Mesh tmpSphere = Mesh.Sphere(device,1,10,10);
mesh = tmpSphere.Clone(0, CustomVertex.PositionNormalColored.Format,
device);
tmpSphere.Dispose();
VertexBuffer vb = mesh.VertexBuffer;
CustomVertex.PositionNormalColored[] vert =
(CustomVertex.PositionNormalColored[])vb.Lock(0,0,0); <-- Error
for(int i=0; i<50; i++)
{
vert[i].Color = System.Drawing.Color.Red.ToArgb();
}
vb.Unlock();
The call to Lock throws an exception:
Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object.
at System.Object.FastGetExistingType()
at System.Object.GetType()
at Microsoft.DirectX.DXHelp.GetObjectSize(Object objectSize)
at Microsoft.DirectX.Direct3D.VertexBuffer.Lock(Int32 offsetToLock,
Type typeVertex, LockFlags flags, Int32[] ranks)
at Microsoft.DirectX.Direct3D.VertexBuffer.Lock(Int32 offsetToLock,
LockFlags flags)
Any idea what's going wrong?
regards,
Achim
- Next message: Just Me: "How to use the Samples framwork"
- Previous message: Jarred Nicholls: "Re: VertexBuffer"
- In reply to: Achim Domma (Procoders): "Simple Example of Mesh.Sphere"
- Next in thread: akuehn: "Re: Simple Example of Mesh.Sphere"
- Reply: akuehn: "Re: Simple Example of Mesh.Sphere"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|