Removed more testing code from Fl_Gl_Overlay

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1051 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2000-03-24 08:55:34 +00:00
parent 9bd57e56b0
commit bb39fe8be0
1 changed files with 31 additions and 35 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.5 2000/03/24 08:48:40 bill Exp $"
// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.6 2000/03/24 08:55:34 bill Exp $"
//
// OpenGL overlay code for the Fast Light Tool Kit (FLTK).
//
@ -103,9 +103,7 @@ int Fl_Gl_Window::can_do_overlay() {
#else // WIN32:
static int no_overlay_hardware = 0;
int Fl_Gl_Window::can_do_overlay() {
if (no_overlay_hardware) return 0;
Fl_Gl_Choice* choice = Fl_Gl_Choice::find(0,0);
return (choice && (choice->pfd.bReserved & 15));
}
@ -124,40 +122,38 @@ void Fl_Gl_Window::make_overlay() {
if (!overlay) {
#if HAVE_GL_OVERLAY
#ifdef WIN32
if (!no_overlay_hardware) {
HDC hdc = fl_private_dc(this, mode_,&g);
GLXContext context = wglCreateLayerContext(hdc, 1);
if (!context) { // no overlay hardware
no_overlay_hardware = 1;
HDC hdc = fl_private_dc(this, mode_,&g);
GLXContext context = wglCreateLayerContext(hdc, 1);
if (!context) {
; // no overlay hardware
} else {
if (fl_first_context) wglShareLists(fl_first_context, context);
else fl_first_context = context;
overlay = context;
LAYERPLANEDESCRIPTOR pfd;
wglDescribeLayerPlane(hdc, g->pixelformat, 1, sizeof(pfd), &pfd);
if (!pfd.iPixelType) {
; // full-color overlay
} else {
if (fl_first_context) wglShareLists(fl_first_context, context);
else fl_first_context = context;
overlay = context;
LAYERPLANEDESCRIPTOR pfd;
wglDescribeLayerPlane(hdc, g->pixelformat, 1, sizeof(pfd), &pfd);
if (!pfd.iPixelType) {
; // full-color overlay
} else {
fl_overlay_depth = pfd.cColorBits; // used by gl_color()
if (fl_overlay_depth > 8) fl_overlay_depth = 8;
COLORREF palette[256];
// copy all colors except #0 into the overlay palette:
for (int i = 0; i < 256; i++) {
uchar r,g,b; Fl::get_color((Fl_Color)i,r,g,b);
palette[i] = RGB(r,g,b);
}
// always provide black & white in the last 2 pixels:
if (fl_overlay_depth < 8) {
palette[(1<<fl_overlay_depth)-2] = RGB(0,0,0);
palette[(1<<fl_overlay_depth)-1] = RGB(255,255,255);
}
// and use it:
wglSetLayerPaletteEntries(hdc, 1, 1, 255, palette+1);
wglRealizeLayerPalette(hdc, 1, TRUE);
fl_overlay_depth = pfd.cColorBits; // used by gl_color()
if (fl_overlay_depth > 8) fl_overlay_depth = 8;
COLORREF palette[256];
// copy all colors except #0 into the overlay palette:
for (int i = 0; i < 256; i++) {
uchar r,g,b; Fl::get_color((Fl_Color)i,r,g,b);
palette[i] = RGB(r,g,b);
}
valid(0);
return;
// always provide black & white in the last 2 pixels:
if (fl_overlay_depth < 8) {
palette[(1<<fl_overlay_depth)-2] = RGB(0,0,0);
palette[(1<<fl_overlay_depth)-1] = RGB(255,255,255);
}
// and use it:
wglSetLayerPaletteEntries(hdc, 1, 1, 255, palette+1);
wglRealizeLayerPalette(hdc, 1, TRUE);
}
valid(0);
return;
}
#else
if (can_do_overlay()) {
@ -213,5 +209,5 @@ void Fl_Gl_Window::hide_overlay() {
#endif
//
// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.5 2000/03/24 08:48:40 bill Exp $".
// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.6 2000/03/24 08:55:34 bill Exp $".
//