From 5abbe21b5210db8442bdba809a9cf27bb584050a Mon Sep 17 00:00:00 2001
From: engelsman This appendix describes the GLUT compatibility header file supplied with FLTK. FLTK's GLUT compatibility is based on the original GLUT 3.7 and the follow-on FreeGLUT 2.4.0 libraries. You should be able to compile existing GLUT source code by including All files calling GLUT procedures must be compiled with C++. You may have to alter them slightly to get them to compile without warnings, and you may have to rename them to get make to use the C++ compiler. You must link with the FLTK library. Most of FL/glut.H is inline functions. You should take a look at it (and maybe at test/glpuzzle.cxx in the FLTK source) if you are having trouble porting your GLUT program. This has been tested with most of the demo programs that come with the GLUT and FreeGLUT distributions. The following functions and/or arguments to functions are missing, and
-you will have to replace them or comment them out for your code to
-compile:
- The strings passed as menu labels are not copied. glutPostRedisplay() does not work if called from inside a
-display function. You must use glutIdleFunc() if you want
-your display to update continuously. glutSwapBuffers() does not work from inside a display
-function. This is on purpose, because FLTK swaps the buffers for you. glutUseLayer() does not work well, and should only be used
+This appendix describes the GLUT compatibility header file supplied with
+FLTK. FLTK's GLUT compatibility is based on the original GLUT 3.7 and
+the follow-on FreeGLUT 2.4.0 libraries.
+
+\section glut_using Using the GLUT Compatibility Header File
+
+You should be able to compile existing GLUT source code by including
+ Overlays are cleared before the overlay display function is called.
-glutLayerGet(GLUT_OVERLAY_DAMAGED) always returns true for
+redraw overlays by using glutOverlayDisplayFunc().
+
+Overlays are cleared before the overlay display function is called.
+glutLayerGet(GLUT_OVERLAY_DAMAGED) always returns true for
compatibility with some GLUT overlay programs. You must rewrite your
-code so that gl_color() is used to choose colors in an
-overlay, or you will get random overlay colors. glutSetCursor(GLUT_CURSOR_FULL_CROSSHAIR) just results in a
-small crosshair. The fonts used by glutBitmapCharacter() and glutBitmapWidth()
- may be different. glutInit(argc,argv) will consume different switches than
+code so that gl_color() is used to choose colors in an
+overlay, or you will get random overlay colors.
+
+glutSetCursor(GLUT_CURSOR_FULL_CROSSHAIR) just results in a
+small crosshair.
+
+The fonts used by glutBitmapCharacter() and glutBitmapWidth()
+may be different.
+
+glutInit(argc,argv) will consume different switches than
GLUT does. It accepts the switches recognized by
-Fl::args(), and will accept any abbreviation of these
-switches (such as "-di" for "-display"). The current GLUT window is available in the global variable
-glut_window. new Fl_Glut_Window(...) is the same as
-glutCreateWindow() except it does not show() the window
+
+The current GLUT window is available in the global variable
+glut_window. Using the GLUT Compatibility Header File
-Known Problems
-
-
- Most of the symbols/enumerations have different values than GLUT uses.
- This will break code that relies on the actual values. The only
-symbols guaranteed to have the same values are true/false pairs like
-GLUT_DOWN and GLUT_UP, mouse buttons
-GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_RIGHT_BUTTON, and
-GLUT_KEY_F1 thru F12.
-Mixing GLUT and FLTK Code
- You can make your GLUT window a child of a Fl_Window with the
-following scheme. The biggest trick is that GLUT insists on show()
-'ing the window at the point it is created, which means the
-Fl_Window parent window must already be shown.
-
-
+Fl::args(), and will accept any abbreviation of these
+switches (such as "-di" for "-display").
+
+\section glut_mixing Mixing GLUT and FLTK Code
+
+You can make your GLUT window a child of a Fl_Window with the
+following scheme. The biggest trick is that GLUT insists on
+show()'ing the window at the point it is created, which means the
+Fl_Window parent window must already be shown.
+
+\li Don't call glutInit().
+\li Create your Fl_Window, and any FLTK widgets. Leave a
+ blank area in the window for your GLUT window.
+\li show() the Fl_Window. Perhaps call
+ show(argc,argv).
+\li Call window->begin() so that the GLUT window will be
+ automatically added to it.
+\li Use glutInitWindowSize() and glutInitWindowPosition()
+ to set the location in the parent window to put the GLUT window.
+\li Put your GLUT code next. It probably does not need many changes.
+ Call window->end() immediately after the
+ glutCreateWindow()!
+\li You can call either glutMainLoop(), Fl::run(),
+ or loop calling Fl::wait() to run the program.
+
\section glut_Fl_Glut_Window class Fl_Glut_Window
-Class Hierarchy
+
+\subsection glut_class_hierarchy Class Hierarchy
+
\code
-Fl_Gl_Window
+Fl_Gl_Window
|
- +----Fl_Glut_Window
+ +----Fl_Glut_Window
\endcode
-Include Files
+\subsection glut_include_files Include Files
\code
#include Description
- Each GLUT window is an instance of this class. You may find it useful
+\subsection glut_description Description
+
+Each GLUT window is an instance of this class. You may find it useful
to manipulate instances directly rather than use GLUT window id's.
- These may be created without opening the display, and thus can fit
+These may be created without opening the display, and thus can fit
better into FLTK's method of creating windows.
-
window->make_current() is the same as -glutSetWindow(number). If the window has not had show() - called on it yet, some functions that assumme an OpenGL context will -not work. If you do show() the window, call make_current() - again to set the context.
-~Fl_Glut_Window() is the same as glutDestroyWindow() -.
-| member | @@ -169,25 +207,33 @@ be altered directly:
|---|