Re: Materials for Mesh.Box

Date: 05/31/04

Date: Sun, 30 May 2004 21:03:31 -0400

I am far from some expert but I wonder a couple of things.
1. Do you get any exceptions at all or are you just ignoring them?
2. is your event handler getting called?
3. Is the background cleared to the blue color you have set or is it just
doing nothing?
4. Did you set a diffuse color for your vertices?
5. Did you set the Rhw to 1?
6. Do you have zbuffers(renderstate) on?
7. Did you enable any lights(you don't need any just asking)?

I am using VB .Net not C# so there are a few "grammatical" differences such
as in your drawprimitives I just specify the type I don't case it from the
vertex buffer type(but that should be fine I assume).

Maybe what you should try to do(unless of course you already have :-) ) , is
just to render the primitives, without the Mesh Box and be assured they

Possibly you are culling incorrectly so you don't see anything
Possibly your project matrix or camera position/look at etc(depending on how
you are placing the camera) is incorrect.
Alot of possibilities, not sure how much more information you have(or have


"GAEL" <> wrote in message
> 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
> box = Mesh.Box(dev, 2.0f, 2.0f, 2.0f);
> box = box.Clone(MeshFlags.Managed, CustomVertex.PositionColored.Format,
> vertexBuffer = box.VertexBuffer;
> vertexBuffer.Created += new
> public void OnCreateVertexBuffer(object sender, EventArgs e)
> {
> VertexBuffer vb = (VertexBuffer)sender;
> CustomVertex.PositionColored[] verts =
> 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