| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #2992
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | New widget: Fl_Gl_Window_Group |
Version: | 1.3-feature |
Created By: | skunk |
Assigned To: | matt |
Fix Version: | 1.4.0 |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | skunk 22:30 Oct 06, 2013 |
| I am in the process of porting a Windows CAD/CAM application to FLTK. Part of this work requires the ability to draw GUI widgets directly on top of OpenGL graphics. I saw that Fl_Gl_Window does not support this (unless the widgets are modified to be drawn using GL calls, which is not practical), and a Web search turned up only a few incomplete solutions for implementing same.
I've thus put together a new widget that adds Fl_Group functionality back to Fl_Gl_Window. After the GL "background" of the window is drawn, child widgets are each drawn into an offscreen buffer, and then copied onto the GL using a textured quad. Events are handled just as in a regular Fl_Window, so things like buttons and text input work as always.
My first-cut implementation is attached, as a patch against branch-1.3 r9997. It does require one minor change to existing source: Fl_Gl_Window::make_current() needs to call Fl_Window::make_current(), or else a segfault will result due to fl_gc == NULL. (Arguably, that superclass call should always have been happening, but as Fl_Gl_Window normally never draws any child widgets it hasn't really mattered.)
This implementation currently has the following limitations:
* Only tested on Linux/X11 so far
* Does not handle non-rectangular widgets correctly
* Its approach of using a single offscreen buffer with dimensions large enough to contain every child widget will be horribly memory-inefficient if the child widgets are, say, a horizontal and vertical scrollbar that span the window
* Documentation still needs to be fleshed out (I'm deferring this until the code is settled)
I'm also attaching the beginnings of a demo program to illustrate the use of the widget. | |
|
#2 | matt 06:04 Jan 20, 2023 |
| Allowing FLTK widgets inside GL windows is a new feature of FLTK 1.4. | |
[ Return to Bugs & Features ]
|
| |