RE: Materials for Mesh.Box
From: GAEL (anonymous_at_discussions.microsoft.com)
Date: 05/30/04
- Next message: cody: "Managed DirectX documentation?"
- Previous message: GAEL: "Materials for Mesh.Box"
- In reply to: GAEL: "Materials for Mesh.Box"
- Next in thread: devnick_at_newsgroups.nospam: "Re: Materials for Mesh.Box"
- Reply: devnick_at_newsgroups.nospam: "Re: Materials for Mesh.Box"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 30 May 2004 16:11:02 -0700
I tried to read some of the messages posted before about this, and I wrote the following code.
The proble is that I can't see anything on the screen when I run the program;
box = Mesh.Box(dev, 2.0f, 2.0f, 2.0f);
box = box.Clone(MeshFlags.Managed, CustomVertex.PositionColored.Format, dev);
vertexBuffer = box.VertexBuffer;
vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer);
public void OnCreateVertexBuffer(object sender, EventArgs e)
{
VertexBuffer vb = (VertexBuffer)sender;
CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vb.Lock( 0,typeof(CustomVertex.PositionColored),0,box.NumberVertices);
numVerts=verts.Length; // I get 24 vertices when I set a breakpoint
vb.Unlock();
}
This is my rendering code. I dont know if the problem comes from here
device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);
device.BeginScene();
SetupMatrices();
device.SetStreamSource(0, vertexBuffer, 0);
device.VertexFormat = CustomVertex.PositionColored.Format;
device.DrawPrimitives((PrimitiveType)vertexBuffer.Type,0, 24); // I got 24 vertices
device.EndScene();
device.Present();
Thanks for your help
- Next message: cody: "Managed DirectX documentation?"
- Previous message: GAEL: "Materials for Mesh.Box"
- In reply to: GAEL: "Materials for Mesh.Box"
- Next in thread: devnick_at_newsgroups.nospam: "Re: Materials for Mesh.Box"
- Reply: devnick_at_newsgroups.nospam: "Re: Materials for Mesh.Box"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|