From 09daf20b81cdae78772f07c0af22a571d7cc73eb Mon Sep 17 00:00:00 2001
From: Michael R Sweet OpenGL hardware typically provides some overlay bit planes, which
-are very useful for drawing UI controls atop your 3D graphics. If the
-overlay hardware is not provided, FLTK tries to simulate the overlay,
-This works pretty well if your graphics are double buffered, but not
+ returns.
+ OpenGL hardware typically provides some overlay bit planes, which
+are very useful for drawing UI controls atop your 3D graphics. If the
+overlay hardware is not provided, FLTK tries to simulate the overlay,
+This works pretty well if your graphics are double buffered, but not
very well for single-buffered. Description
- The Fl_Gl_Window widget sets things up so OpenGL works, and
-also keeps an OpenGL "context" for that window, so that changes to the
+ The Fl_Gl_Window widget sets things up so OpenGL works, and
+also keeps an OpenGL "context" for that window, so that changes to the
lighting and projection may be reused between redraws. Fl_Gl_Window
also flushes the OpenGL streams and swaps buffers after draw()
- returns.
-Methods
The draw() method can only use OpenGL calls. Do not +valid() at the start of draw() and only doing the +initialization if it is false. +
The draw() method can only use OpenGL calls. Do not attempt to call X, any of the functions in <FL/fl_draw.H>, or glX directly. Do not call gl_start() or gl_finish().
-If double-buffering is enabled in the window, the back and front +
If double-buffering is enabled in the window, the back and front buffers are swapped after this function is completed.
If the desired combination cannot be done, FLTK will try turning off FL_MULTISAMPLE. If this also fails the show() will call Fl::error() and not show the window.
-You can change the mode while the window is displayed. This is most -useful for turning double-buffering on and off. Under X this will -cause the old X window to be destroyed and a new one to be created. If -this is a top-level window this will unfortunately also cause the +
You can change the mode while the window is displayed. This is most +useful for turning double-buffering on and off. Under X this will +cause the old X window to be destroyed and a new one to be created. If +this is a top-level window this will unfortunately also cause the window to blink, raise to the top, and be de-iconized, and the xid() - will change, possibly breaking other code. It is best to make the GL + will change, possibly breaking other code. It is best to make the GL window a child of another window if you wish to do this!
void mywindow::draw() {
if (!valid()) {
@@ -153,59 +153,59 @@ void mywindow::draw() {
}
-You can turn valid() on by calling valid(1). You
+You can turn valid() on by calling valid(1). You
should only do this after fixing the transformation inside a draw()
or after make_current(). This is done automatically after
-draw() returns.
+draw() returns.
Both this function and Fl_Gl_Window::draw() should check -Fl_Gl_Window::valid() and set the same transformation. If you -don't your code may not work on other systems. Depending on the OS, -and on whether overlays are real or simulated, the OpenGL context may +Fl_Gl_Window::valid() and set the same transformation. If you +don't your code may not work on other systems. Depending on the OS, +and on whether overlays are real or simulated, the OpenGL context may be the same or different between the overlay and main window.