Information about Defining Images, & Examples
Example:
<def_obj> BuildingT79
<image> skyscraper.ppm <vrt 118.03 0 -259.674/> <vrt 57.36 106.4 -59.4/>
<vrt 157.36 0 -259.674/> <vrt 157.36 206.467 -259.674/>
</image>
<col 0.19 0.27 0.28 1/>
<tri> <vrt 118.03 206.467 -259.674/>
<vrt 118.03 0 -259.674/> <vrt 157.36 206.467 -259.674/>
</tri>
</def_obj>
Note that images require four vertices. See above notes on quads for
discussion about winding order. Not all image formats are currently
supported on all platforms. The .ppm format is supported on all platforms.
Image dimensions (width/height in columns/rows) which are not a power of
two (ex. 32, 64, 128, 256, etc..) will cause OpenGL to tile or repeat the
image until it fits within the next power of two. This is good for
textures which you wish to have applied as tiles. If you need a one-to-one
match with your quad, resize your image so that the sides are powers of 2.
The number of rows must equal the number of columns or else you will get
bizarre results. Images can be converted to PPM and resized through any of a
variety of programs, such as ImageMagik Convert, XV, The Gimp,
cjpeg, and netpbm.
You do not need to match an image file directly to each polygon rendered.
You can use different slices of a common image to cover many different polygons.
Placing "slice" coordinates before each vertex tells where out of
a large image to map the slice to. The slice coordinates map
an x-y region within an image to an x,y,z position in 3-space.
The slice coords range from 0.0 -to- 1.0 (floating point). For example,
(0.0,0.0) is the upper left corner of the image, and (1.0,1.0) is
the bottom right corner, regardless of pixel dimensions of the image.
Example:
<image> pic.ppm
<slc 0.4 0.2> <vrt 118.03 0 -259.674/>
<slc 0.6 0.2> <vrt 57.36 106.4 -59.4/>
<slc 0.6 0.3> <vrt 157.36 0 -259.674/>
<slc 0.4 0.3> <vrt 157.36 206.467 -259.674/>
</image>
This gives you the power to warp images in various ways.
The default method is equivalent to:
<image> pic.ppm
<slc 0.0 0.0> <vrt 118.03 0 -259.674/>
<slc 1.0 0.0> <vrt 57.36 106.4 -59.4/>
<slc 1.0 1.0> <vrt 157.36 0 -259.674/>
<slc 0.0 1.0> <vrt 157.36 206.467 -259.674/>
</image>
Example Winding Order:
(1)------------>(2)
|
|
|
|
v
(4)<------------(3)
The above winding order makes the quad or image viewable from one side, and
invisible from the other side. For example, the winding order 1, 4, 3, 2, is also
valid, and will make the quad/image viewable form the opposite side. However, an
order such as 1, 3, 4, 2, is not valid, because the vertices will cross
and do not circle the perimeter.
Back