summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-30 19:25:23 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-30 19:25:23 +0200
commit0627213a824388321b8b39ff2476f5dc04f56638 (patch)
treeb83617df45f926f8321109c5b7e668b6acc28e55 /src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
parentbb6072ad8290ae98568ea424cae183939404daca (diff)
FLTK widgets in OpenGL 3 windows: rewrite for driver system.
Diffstat (limited to 'src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
index 7952dfdc1..ca72d3e92 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
@@ -25,6 +25,10 @@
#include "../GDI/Fl_Font.H"
extern void fl_save_dc(HWND, HDC);
+#ifndef GL_CURRENT_PROGRAM
+# define GL_CURRENT_PROGRAM 0x8B8D // from glew.h
+#endif
+
// STR #3119: select pixel format with composition support
// ... and no more than 32 color bits (8 bits/color)
// Ref: PixelFormatDescriptor Object
@@ -368,6 +372,22 @@ void Fl_WinAPI_Gl_Window_Driver::get_list(Fl_Font_Descriptor *fd, int r) {
}
+typedef void (WINAPI *glUseProgram_type)(GLint);
+static glUseProgram_type glUseProgram_f = NULL;
+
+void Fl_WinAPI_Gl_Window_Driver::switch_to_GL1() {
+ if (!glUseProgram_f) {
+ glUseProgram_f = (glUseProgram_type)GetProcAddress("glUseProgram");
+ }
+ glGetIntegerv(GL_CURRENT_PROGRAM, &current_prog);
+ if (current_prog) glUseProgram_f(0);
+}
+
+void Fl_WinAPI_Gl_Window_Driver::switch_back() {
+ if (current_prog) glUseProgram_f((GLuint)current_prog);
+}
+
+
FL_EXPORT HGLRC fl_win32_glcontext(GLContext rc) { return (HGLRC)rc; }
#endif // HAVE_GL