RE: Materials for Mesh.Box

From: GAEL (anonymous_at_discussions.microsoft.com)
Date: 05/30/04


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



Relevant Pages

  • Re: Materials for Mesh.Box
    ... Is the background cleared to the blue color you have set or is it just ... Possibly your project matrix or camera position/look at etc(depending on how ... > The proble is that I can't see anything on the screen when I run the ... > This is my rendering code. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Materials for Mesh.Box
    ... My rendering code was wrong. ... I dont know if the problem comes from here ... device.SetStreamSource(0, vertexBuffer, 0); ... I changed it to render the mesh after it has been cloned and after its vertices have been changed. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Huygens shortlived?
    ... I can see now why the proble had to be the ... observatory continued to detect data from Huygens 3 hours after Cassini ... Whether the data was useful - i dont know. ...
    (sci.space.policy)
  • Re: Huygens shortlived?
    ... I can see now why the proble had to be the ... observatory continued to detect data from Huygens 3 hours after Cassini ... Whether the data was useful - i dont know. ...
    (sci.space.tech)
  • Re: Huygens shortlived?
    ... I can see now why the proble had to be the ... observatory continued to detect data from Huygens 3 hours after Cassini ... Whether the data was useful - i dont know. ...
    (sci.astro)