blob: e444704692cafc4d08f9e13487a32856fa1a825f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
//
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#include <config.h>
#if HAVE_GL
# include <FL/Fl.H>
# include "Fl_Gl_Choice.H"
# include <FL/Fl_Gl_Window.H>
# include "Fl_Gl_Window_Driver.H"
# include <FL/gl_draw.H>
GLContext *Fl_Gl_Window_Driver::context_list = 0;
int Fl_Gl_Window_Driver::nContext = 0;
static int NContext = 0;
void Fl_Gl_Window_Driver::add_context(GLContext ctx) {
if (!ctx) return;
if (nContext==NContext) {
if (!NContext) NContext = 8;
NContext *= 2;
context_list = (GLContext*)realloc(
context_list, NContext*sizeof(GLContext));
}
context_list[nContext++] = ctx;
}
void Fl_Gl_Window_Driver::del_context(GLContext ctx) {
int i;
for (i=0; i<nContext; i++) {
if (context_list[i]==ctx) {
memmove(context_list+i, context_list+i+1,
(nContext-i-1) * sizeof(GLContext));
context_list[--nContext] = 0;
break;
}
}
if (!nContext) gl_remove_displaylist_fonts();
}
Fl_Gl_Choice *Fl_Gl_Window_Driver::first;
/**
\cond DriverDev
\addtogroup DriverDeveloper
\{
*/
// this assumes one of the two arguments is zero:
// We keep the list system in Win32 to stay compatible and interpret
// the list later...
Fl_Gl_Choice *Fl_Gl_Window_Driver::find_begin(int m, const int *alistp) {
Fl_Gl_Choice *g;
for (g = first; g; g = g->next)
if (g->mode == m && g->alist == alistp)
return g;
return NULL;
}
/**
\}
\endcond
*/
#endif // HAVE_GL
|