Re: Newbie questions about textures, meshes and lights
From: ZMan (news-replies_at_thezbuffer)
Date: Sun, 2 May 2004 16:40:08 -0700
1. Its hard to debug this without any more information. Do you have normals
defined, is the light bright enough, is the triangle facing the light, is
the material of the triangle set up. What vertex format are you using.
2. Meshes probably rely on you having lights set up. Try turning on an
ambient background and see.
3. When you make mesh.box it doesn't have any texture coordinates set up as
you suspected. You need to change the mesh to have texture coodinates. This
means using mesh.clone to make a new mesh with the right vertex format, then
filling them in correctly. Correctly means different things depending on the
effect but for a box it best to start with the same texture on each face so
walk through the vertices and work out which one is which face then just set
the coordinates to either 0,0 or 1.0 . This is hard to explain without
drawing it for you. Good luck. Alternativly you might be able to find a box
mesh in .x format that already has these set.
"Jose A. Gonzalvo" <email@example.com> wrote in message
> I have some problems with textures and lights.
> 1. I can render a texturized triangle, but if I turn on lights the
> goes black.
> 2. I can render a texturized triangle with lights off, but if I render a
> 'mesh' it goes black (the triangle).
> 2. How can I apply texture to a mesh created like this myObj =
> Mesh.Box(device, 1.0f, 1.0f, 1.0f). I execute device.SetTexture before
> render the mesh, but I guess I should define the texture coordinates to
> mesh, how?
> Thanks in advance and excuse my poor english.