Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GL_TRIANGLE (3)


gl_triangle - draw a triangle with interpolated colors


See Also


#include <triangle.h>

void gl_triangle(int x0, int y0, int z0, int x1, int y1 , int z1, int x2, int y2, int z2, int bf);


Draws a triangle between the three points 0, 1 and 2.

z0, z1 and z2 are the colors at those points. Hence, if you set the palette to a grayscale, the triangle will have an interpolated gray shade.

If you are using more than 8 bit color, the z values will be interpreted as an index to a lookup table of at most 4096 entries long. Each entry is of type long.

You can set the entries with the function gl_trisetcolorlookup(3).

The bf value is used to tell the routine not to draw the triangle if it is facing the other way. bf tells which way the triangle should be facing to be drawn. since you will more than likely require both combinations.

bf = 0 disables drawing when the points are arranged clockwise, bf = 1 disables drawing when the points are arranged counter clockwise. bf = -1 will probably always draw the triangle.

Beware, these functions are not a direct part of the svgalib library. Instead their source is part of svgalib and can be found in the threeDkit/ subdirectory of the original svgalib distribution. However, it is not installed in the system by default, s.t. it is unclear where you can find it if your svgalib was installed by some linux distribution.

In case of any such problem, simply get an svgalib distribution from the net. Yo don’t need to install it. Just make in the threeDkit/ subdirectory. As of this writing, svgalib-1.2.12.tar.gz is the latest version and can be retrieved by ftp from at /pub/Linux/libs/graphics and at /pub/linux/sources/libs which will most probably be mirrored by a site close to you.

The functions are defined in the tri.o and triangl.o files (or their resp. sources) which you must link to your program.


vgagl(7), svgalib(7), threedkit(7), gl_striangle(3), gl_swtriangle(3), gl_trigetcolorlookup(3), gl_trisetcolorlookup(3), gl_trisetdrawpoint(3), gl_wtriangle(3), plane(6), wrapdemo(6).


This manual page was edited by Michael Weller <>. The demos, the initial documentation and the whole threedkit stuff was done by Paul Sheer <>.

Paper mail:

Paul Sheer
P O BOX 890507
Johannesburg 2106
South Africa

Donations (by check or postal order) will be appreciated and will encourage further development of this software. However this is strictly on a voluntary basis where this software falls under the GNU LIBRARY GENERAL PUBLIC LICENSE.

Search for    or go to Top of page |  Section 3 |  Main Index

Svgalib (>= 1.2.11) GL_TRIANGLE (3) 2 Aug 1997

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.