Game Development Reference
In-Depth Information
sx * Ax + sy * Ay + Az
sx * Cx + sy * Cy + Cz
u =
sx * Bx + sy * By + Bz
sx * Cx + sy * Cy + Cz
v =
To achieve the textured polygon we need to raster scan the polygon in
the same way that we have done for flat and shaded polygons. For each
screen pixel we calculate the texture coordinates ( u , v ), scale them by the
width and height of the texture, and paint to the screen the colour of the
texture for the coordinates calculated. You will see from the example that
this is a slow operation. To speed up the results, we can use interpolation
techniques, calculating texture coordinates for the start and end of a scan
line then interpolating between these. There are many other ways to
speed up the results.
Summary
We learnt a great deal in this chapter, but although this is fascinating stuff,
unless you want to rewrite the OpenGL graphics library you will not have
to deal with graphics operations at such a low level. But it is useful to know
how things are happening in the background if only to leave you with a
sense of awe that computers are able to deal with so many instructions to
display a real-time animation display.
Search Nedrilad ::




Custom Search