Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. enum {
  2. COLOR_BLACK = 0,
  3. COLOR_RED,
  4. COLOR_GREEN,
  5. COLOR_YELLOW,
  6. COLOR_BLUE,
  7. COLOR_MAGENTA,
  8. COLOR_CYAN,
  9. COLOR_WHITE
  10. };
  11. static float RGBMap[9][3] = {
  12. {0, 0, 0},
  13. {1, 0, 0},
  14. {0, 1, 0},
  15. {1, 1, 0},
  16. {0, 0, 1},
  17. {1, 0, 1},
  18. {0, 1, 1},
  19. {1, 1, 1},
  20. {0.5, 0.5, 0.5}
  21. };
  22. static void SetColor(int c)
  23. {
  24. if (glutGet(GLUT_WINDOW_RGBA))
  25. glColor3fv(RGBMap[c]);
  26. else
  27. glIndexf(c);
  28. }
  29. static void InitMap(void)
  30. {
  31. int i;
  32. if (rgb)
  33. return;
  34. for (i = 0; i < 9; i++)
  35. glutSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]);
  36. }
  37. static void SetFogRamp(int density, int startIndex)
  38. {
  39. int fogValues, colorValues;
  40. int i, j, k;
  41. float intensity;
  42. fogValues = 1 << density;
  43. colorValues = 1 << startIndex;
  44. for (i = 0; i < colorValues; i++) {
  45. for (j = 0; j < fogValues; j++) {
  46. k = i * fogValues + j;
  47. intensity = (i * fogValues + j * colorValues) / 255.0;
  48. glutSetColor(k, intensity, intensity, intensity);
  49. }
  50. }
  51. }
  52. static void SetGreyRamp(void)
  53. {
  54. int i;
  55. float intensity;
  56. for (i = 0; i < 255; i++) {
  57. intensity = i / 255.0;
  58. glutSetColor(i, intensity, intensity, intensity);
  59. }
  60. }