Teapot Sample in DirectX 101

i have opened the sample framework and then installed the EmptyProject after that i wrote these codes to my solution:

//Variables Section

private Mesh teapotmesh = null; //Mesh that helps teapot being rendered
private Material teapotmaterial; //Material that heps teapot being rendered.

Find OnCreateDevice Method and wite that code:

teapotmesh = Mesh.Teapot(e.Device);
teapotmaterial = new Material();
teapotmaterial.DiffuseColor = new ColorValue(1.0f, 1.0f, 1.0f, 1.0f);

Find OnResetDevice and write that code:

e.Device.Lights[0].DiffuseColor = new ColorValue(1.0f, 1.0f, 1.0f, 1.0f);
e.Device.Lights[0].Direction = new Vector3(0, -1, 0);
e.Device.Lights[0].Type = LightType.Directional;
e.Device.Lights[0].Enabled = true;

Find OnFrameRender method and after BeginScene function write these codes:

device.Transform.View = camera.ViewMatrix;
device.Transform.Projection = camera.ProjectionMatrix;
device.Transform.World = Matrix.RotationX((float)appTime);
device.Material = teapotmaterial;
teapotmesh.DrawSubset(0);

And run the project

the view will be like that


Next Recommended Reading 50 Sample Silverlight Applications