mirror of https://github.com/fltk/fltk
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:
parent
9bd57e56b0
commit
bb39fe8be0
|
@ -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).
|
// OpenGL overlay code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
|
@ -103,9 +103,7 @@ int Fl_Gl_Window::can_do_overlay() {
|
||||||
|
|
||||||
#else // WIN32:
|
#else // WIN32:
|
||||||
|
|
||||||
static int no_overlay_hardware = 0;
|
|
||||||
int Fl_Gl_Window::can_do_overlay() {
|
int Fl_Gl_Window::can_do_overlay() {
|
||||||
if (no_overlay_hardware) return 0;
|
|
||||||
Fl_Gl_Choice* choice = Fl_Gl_Choice::find(0,0);
|
Fl_Gl_Choice* choice = Fl_Gl_Choice::find(0,0);
|
||||||
return (choice && (choice->pfd.bReserved & 15));
|
return (choice && (choice->pfd.bReserved & 15));
|
||||||
}
|
}
|
||||||
|
@ -124,40 +122,38 @@ void Fl_Gl_Window::make_overlay() {
|
||||||
if (!overlay) {
|
if (!overlay) {
|
||||||
#if HAVE_GL_OVERLAY
|
#if HAVE_GL_OVERLAY
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (!no_overlay_hardware) {
|
HDC hdc = fl_private_dc(this, mode_,&g);
|
||||||
HDC hdc = fl_private_dc(this, mode_,&g);
|
GLXContext context = wglCreateLayerContext(hdc, 1);
|
||||||
GLXContext context = wglCreateLayerContext(hdc, 1);
|
if (!context) {
|
||||||
if (!context) { // no overlay hardware
|
; // no overlay hardware
|
||||||
no_overlay_hardware = 1;
|
} 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 {
|
} else {
|
||||||
if (fl_first_context) wglShareLists(fl_first_context, context);
|
fl_overlay_depth = pfd.cColorBits; // used by gl_color()
|
||||||
else fl_first_context = context;
|
if (fl_overlay_depth > 8) fl_overlay_depth = 8;
|
||||||
overlay = context;
|
COLORREF palette[256];
|
||||||
LAYERPLANEDESCRIPTOR pfd;
|
// copy all colors except #0 into the overlay palette:
|
||||||
wglDescribeLayerPlane(hdc, g->pixelformat, 1, sizeof(pfd), &pfd);
|
for (int i = 0; i < 256; i++) {
|
||||||
if (!pfd.iPixelType) {
|
uchar r,g,b; Fl::get_color((Fl_Color)i,r,g,b);
|
||||||
; // full-color overlay
|
palette[i] = RGB(r,g,b);
|
||||||
} 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);
|
|
||||||
}
|
}
|
||||||
valid(0);
|
// always provide black & white in the last 2 pixels:
|
||||||
return;
|
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
|
#else
|
||||||
if (can_do_overlay()) {
|
if (can_do_overlay()) {
|
||||||
|
@ -213,5 +209,5 @@ void Fl_Gl_Window::hide_overlay() {
|
||||||
#endif
|
#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 $".
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue