1gl_triangle(3) Svgalib User Manual gl_triangle(3)
2
3
4
6 gl_triangle - draw a triangle with interpolated colors
7
8
10 #include <triangle.h>
11
12 void gl_triangle(int x0, int y0, int z0, int x1, int y1 , int z1, int
13 x2, int y2, int z2, int bf);
14
15
17 Draws a triangle between the three points 0, 1 and 2.
18
19 z0, z1 and z2 are the colors at those points. Hence, if you set the
20 palette to a grayscale, the triangle will have an interpolated gray
21 shade.
22
23 If you are using more than 8 bit color, the z values will be inter‐
24 preted as an index to a lookup table of at most 4096 entries long. Each
25 entry is of type long.
26
27 You can set the entries with the function gl_trisetcolorlookup(3).
28
29 The bf value is used to tell the routine not to draw the triangle if it
30 is facing the other way. bf tells which way the triangle should be
31 facing to be drawn. since you will more than likely require both com‐
32 binations.
33
34 bf = 0 disables drawing when the points are arranged clockwise, bf = 1
35 disables drawing when the points are arranged counter clockwise. bf =
36 -1 will probably always draw the triangle.
37
38 Beware, these functions are not a direct part of the svgalib library.
39 Instead their source is part of svgalib and can be found in the threeD‐
40 kit/ subdirectory of the original svgalib distribution. However, it is
41 not installed in the system by default, s.t. it is unclear where you
42 can find it if your svgalib was installed by some linux distribution.
43
44 In case of any such problem, simply get an svgalib distribution from
45 the net. Yo don't need to install it. Just make in the threeDkit/ sub‐
46 directory. As of this writing, svgalib-1.2.12.tar.gz is the latest ver‐
47 sion and can be retrieved by ftp from sunsite.unc.edu at
48 /pub/Linux/libs/graphics and tsx-11.mit.edu at /pub/linux/sources/libs
49 which will most probably be mirrored by a site close to you.
50
51 The functions are defined in the tri.o and triangl.o files (or their
52 resp. sources) which you must link to your program.
53
54
56 vgagl(7), svgalib(7), threedkit(7), gl_striangle(3), gl_swtriangle(3),
57 gl_trigetcolorlookup(3), gl_trisetcolorlookup(3), gl_trisetdraw‐
58 point(3), gl_wtriangle(3), plane(6), wrapdemo(6).
59
60
62 This manual page was edited by Michael Weller <eowmob@exp-math.uni-
63 essen.de>. The demos, the initial documentation and the whole threedkit
64 stuff was done by Paul Sheer <psheer@icon.co.za>.
65
66 Paper mail:
67 Paul Sheer
68 P O BOX 890507
69 Lyndhurst
70 Johannesburg 2106
71 South Africa
72
73 Donations (by check or postal order) will be appreciated and will
74 encourage further development of this software. However this is
75 strictly on a voluntary basis where this software falls under the GNU
76 LIBRARY GENERAL PUBLIC LICENSE.
77
78
79
80Svgalib (>= 1.2.11) 2 Aug 1997 gl_triangle(3)