summaryrefslogtreecommitdiff
path: root/src/gl_start.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-16 09:29:13 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-16 09:29:13 +0100
commit1adaa3def2138fafd40b9d9df212a068c57cdbf4 (patch)
tree0898ea907c763d197d5137dc299eef8005c16de1 /src/gl_start.cxx
parent1f55bfe65cc8ca6e7b79efad66a7c304a69b12fe (diff)
Create classes Fl_XXX_Gl_Window_Driver according to driver model.
Diffstat (limited to 'src/gl_start.cxx')
-rw-r--r--src/gl_start.cxx36
1 files changed, 5 insertions, 31 deletions
diff --git a/src/gl_start.cxx b/src/gl_start.cxx
index 250bca27e..f96786c8e 100644
--- a/src/gl_start.cxx
+++ b/src/gl_start.cxx
@@ -37,21 +37,21 @@ class Fl_Gl_Choice;
#include <FL/Fl_Gl_Window.H>
#include "Fl_Gl_Window_Driver.H"
-static GLContext context;
+GLContext Fl_Gl_Window_Driver::gl_start_context;
static int clip_state_number=-1;
static int pw, ph;
float gl_start_scale = 1;
-static Fl_Gl_Choice* gl_choice;
+static Fl_Gl_Choice* gl_choice = NULL;
/** Creates an OpenGL context */
void gl_start() {
gl_start_scale = Fl_Display_Device::display_device()->driver()->scale();
- if (!context) {
+ if (!Fl_Gl_Window_Driver::gl_start_context) {
if (!gl_choice) Fl::gl_visual(0);
- context = Fl_Gl_Window_Driver::global()->create_gl_context(Fl_Window::current(), gl_choice);
+ Fl_Gl_Window_Driver::gl_start_context = Fl_Gl_Window_Driver::global()->create_gl_context(Fl_Window::current(), gl_choice);
}
- Fl_Gl_Window_Driver::global()->set_gl_context(Fl_Window::current(), context);
+ Fl_Gl_Window_Driver::global()->set_gl_context(Fl_Window::current(), Fl_Gl_Window_Driver::gl_start_context);
Fl_Gl_Window_Driver::global()->gl_start();
if (pw != int(Fl_Window::current()->w() * gl_start_scale) || ph != int(Fl_Window::current()->h() * gl_start_scale)) {
pw = int(Fl_Window::current()->w() * gl_start_scale);
@@ -94,32 +94,6 @@ void Fl_Gl_Window_Driver::gl_visual(Fl_Gl_Choice *c) {
gl_choice = c;
}
-#ifdef FL_CFG_GFX_QUARTZ
-#include "drivers/Cocoa/Fl_Cocoa_Window_Driver.H"
-
-void Fl_Cocoa_Gl_Window_Driver::gl_start() {
- Fl_Cocoa_Window_Driver::gl_start(context);
-}
-
-#endif
-
-
-#ifdef FL_CFG_GFX_XLIB
-#include <FL/platform.H>
-#include "Fl_Gl_Choice.H"
-
-void Fl_X11_Gl_Window_Driver::gl_visual(Fl_Gl_Choice *c) {
- Fl_Gl_Window_Driver::gl_visual(c);
- fl_visual = c->vis;
- fl_colormap = c->colormap;
-}
-
-void Fl_X11_Gl_Window_Driver::gl_start() {
- glXWaitX();
-}
-
-#endif // FL_CFG_GFX_XLIB
-
int Fl::gl_visual(int mode, int *alist) {
Fl_Gl_Choice *c = Fl_Gl_Window_Driver::global()->find(mode,alist);
if (!c) return 0;