[code]
do this before your render loop else youll keep recreating the teapot
createmesh("C:\Documents and Settings\Reintje\Mijn documenten\Reinjan\informatica en school\GIP\Models")
Do While Me.Created
Application.DoEvents()
clear the device in preparation for rendering
device.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, Color.Black, 1.0, 0)
begin the scene
device.BeginScene()
device.Transform.World = world
device.Material = teapotColor
device.SetTexture(0, Nothing)
teapot.DrawSubset(0)
device.Transform.View = view
device.Transform.Projection = projection
device.EndScene()
New line
device.Present()
Loop
End Sub
Private Sub createmesh(ByVal path As String)
the teapot is available as a static method from Mesh
teapot = Mesh.Teapot(device)
setup the color for the teapot
teapotColor = New Material
teapotColor.Diffuse = Color.Red
teapotColor.Ambient = teapotColor.Diffuse
set initial values for the view and world transforms
view = Matrix.LookAtLH(New Vector3(0, 3.5, -4), New Vector3(0, 0, 0), New Vector3(0, 1, 0))
world = Matrix.Identity
enable z-buffering
device.RenderState.ZBufferEnable = True
enable lighting
device.RenderState.Lighting = True
set the ambient color
device.RenderState.Ambient = Color.Gray
configure a directional light
device.Lights(0).Type = LightType.Directional
device.Lights(0).Direction = New Vector3(2.0, -1.0, 0.0)
device.Lights(0).Diffuse = Color.White
device.Lights(0).Enabled = True
device.Lights(0).Update()
End Sub
[/code]