summaryrefslogtreecommitdiff
path: root/src/fl_color_win32.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-11-08 15:55:23 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-11-08 15:55:23 +0000
commit32d18a35914c8b09165a43ec0eb8bfaa83d2712e (patch)
tree5136f8457ba87675af1e941960f515829ccbd338 /src/fl_color_win32.cxx
parent0768612ddbeef6977a756a13f909bbb83ee2d9c6 (diff)
Added 8-bit palette for OpenGL (3:3:2 RGB). This should fix all of the
OpenGL colormap problems... git-svn-id: file:///fltk/svn/fltk/trunk@73 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_color_win32.cxx')
-rw-r--r--src/fl_color_win32.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/fl_color_win32.cxx b/src/fl_color_win32.cxx
index da8431395..a55f17850 100644
--- a/src/fl_color_win32.cxx
+++ b/src/fl_color_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_color_win32.cxx,v 1.3 1998/10/21 14:20:45 mike Exp $"
+// "$Id: fl_color_win32.cxx,v 1.4 1998/11/08 15:55:23 mike Exp $"
//
// WIN32 color functions for the Fast Light Tool Kit (FLTK).
//
@@ -47,6 +47,9 @@ Fl_XMap fl_xmap[256];
Fl_XMap* fl_current_xmap;
HPALETTE fl_palette;
+#if HAVE_GL
+HPALETTE fl_gl_palette;
+#endif // HAVE_GL
static void clear_xmap(Fl_XMap& xmap) {
if (xmap.pen) {
@@ -214,6 +217,21 @@ fl_select_palette(void)
// Create the palette:
fl_palette = CreatePalette(pPal);
+
+#if HAVE_GL
+ // Now do the OpenGL palette... Any 8-bit display will want 3:3:2 RGB,
+ // and doing OpenGL on anything less than 8-bits is just asking for
+ // disappointment!
+
+ for (int i = 0; i < nColors; i ++) {
+ pPal->palPalEntry[i].peRed = 255 * ((i >> 5) & 7) / 7;
+ pPal->palPalEntry[i].peGreen = 255 * ((i >> 2) & 7) / 7;
+ pPal->palPalEntry[i].peBlue = 255 * (i & 3) / 3;
+ pPal->palPalEntry[i].peFlags = 0;
+ };
+
+ fl_gl_palette = CreatePalette(pPal);
+#endif // HAVE_GL
}
if (fl_palette) {
SelectPalette(fl_gc, fl_palette, FALSE);
@@ -225,5 +243,5 @@ fl_select_palette(void)
#endif
//
-// End of "$Id: fl_color_win32.cxx,v 1.3 1998/10/21 14:20:45 mike Exp $".
+// End of "$Id: fl_color_win32.cxx,v 1.4 1998/11/08 15:55:23 mike Exp $".
//