From da66e21e1d5826639da2b8d3bd5ccd27920a4aad Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 29 Sep 2022 09:39:21 +0200 Subject: Support of FLTK widgets in OpenGL 3 windows - cont'd. This commit allows to switch between FL_DOUBLE / FL_SINGLE modes in widget-containing GL3 windows. Demo program examples/OpenGL3test is modified to show FLTK widgets even if the platform does not support OpenGL 3. --- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx | 1 - src/gl_draw.cxx | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx index bb4c53df1..3ee281b37 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx @@ -27,7 +27,6 @@ #include #include -extern void gl_texture_reset(); #ifdef __OBJC__ @class NSOpenGLPixelFormat; diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 3104f161d..b786b830d 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -319,11 +319,6 @@ int gl_texture_fifo::already_known(const char *str, int n) static gl_texture_fifo *gl_fifo = NULL; // points to the texture pile class instance -void gl_texture_reset() -{ - if (gl_fifo) gl_texture_pile_height(gl_texture_pile_height()); -} - // Cross-platform implementation of the texture mechanism for text rendering // using textures with the alpha channel only. @@ -465,6 +460,15 @@ int gl_texture_pile_height(void) return gl_fifo->size(); } +/** To call after GL operations that may invalidate textures used to draw text in GL scenes + (e.g., switch between FL_DOUBLE / FL_SINGLE modes). + */ +void gl_texture_reset() +{ + if (gl_fifo) gl_texture_pile_height(gl_texture_pile_height()); +} + + /** Changes the maximum height of the pile of pre-computed string textures -- cgit v1.2.3