nvfx: expose GLSL
[mesa/mesa-lb.git] / progs / tests / tkmap.c
blob3ded79cacaa0e083b7fced4ef9566b22f7b7a3ad
2 enum {
3 COLOR_BLACK = 0,
4 COLOR_RED,
5 COLOR_GREEN,
6 COLOR_YELLOW,
7 COLOR_BLUE,
8 COLOR_MAGENTA,
9 COLOR_CYAN,
10 COLOR_WHITE
13 static float RGBMap[9][3] = {
14 {0, 0, 0},
15 {1, 0, 0},
16 {0, 1, 0},
17 {1, 1, 0},
18 {0, 0, 1},
19 {1, 0, 1},
20 {0, 1, 1},
21 {1, 1, 1},
22 {0.5, 0.5, 0.5}
25 static void SetColor(int c)
27 if (glutGet(GLUT_WINDOW_RGBA))
28 glColor3fv(RGBMap[c]);
29 else
30 glIndexf(c);
33 static void InitMap(void)
35 int i;
37 if (rgb)
38 return;
40 for (i = 0; i < 9; i++)
41 glutSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]);
44 static void SetFogRamp(int density, int startIndex)
46 int fogValues, colorValues;
47 int i, j, k;
48 float intensity;
50 fogValues = 1 << density;
51 colorValues = 1 << startIndex;
52 for (i = 0; i < colorValues; i++) {
53 for (j = 0; j < fogValues; j++) {
54 k = i * fogValues + j;
55 intensity = (i * fogValues + j * colorValues) / 255.0;
56 glutSetColor(k, intensity, intensity, intensity);
61 static void SetGreyRamp(void)
63 int i;
64 float intensity;
66 for (i = 0; i < 255; i++) {
67 intensity = i / 255.0;
68 glutSetColor(i, intensity, intensity, intensity);