Game Development Reference
In-Depth Information
//second vertex
glNormal3d(pt->mx, pt->my, pt->mz);
glTexCoord2f(ply->tc[1].u, ply->tc[1].v);
glVertex3d(pt->wx, pt->wy, pt->wz);
//third vertex
glNormal3d(pt->mx, pt->my, pt->mz);
glTexCoord2f(ply->tc[2].u, ply->tc[2].v);
glVertex3d(pt->wx, pt->wy, pt->wz);
Now you have the armoury to display fully textured meshes.
There are many details to consider in this chapter, and if any of them are
handled incorrectly in your code then you are likely to experience the
frustration of no texturing on your meshes. You are advised to work
through the code samples carefully. Create a Windows bitmap loader first
and then make sure it works by displaying the results of the load using a
Windows API call such as StretchDIBits. Once your bitmap loader is
working, try mapping it directly to a single four-sided polygon as
suggested. This proves that the pixel storage and unpacking methods are
correctly set and that the texture environment parameters are defined.
Then try mapping a single planar texture to a mesh by using the code
fragments to define the texture coordinates; if everything is working
correctly then you should have a textured mesh. The texture will move
with your mesh as it moves.
Search Nedrilad ::

Custom Search