From 87dd7f0d23eba5c09e71ec6efeb34c6844f5e95f Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 29 Dec 1998 14:21:17 +0000 Subject: Revised documentation files. git-svn-id: file:///fltk/svn/fltk/trunk@177 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/glut.html | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 documentation/glut.html (limited to 'documentation/glut.html') diff --git a/documentation/glut.html b/documentation/glut.html new file mode 100644 index 000000000..3cbfdb50e --- /dev/null +++ b/documentation/glut.html @@ -0,0 +1,145 @@ + + + +

D - GLUT Compatibility

+ +You should be able to compile existing Glut source code by +including <FL/glut.H> instead of <GL/glut.h>. This can be done by +editing the source, by changing the -I switches to the compiler, or by +providing a symbolic link from GL/glut.h to FL/glut.H. + +

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. +I was unable to get some calls to glu to compile without adding some +casts, apparently due to errors in the glu header files. + +

You must link with -lFl. If you call any glut drawing functions +that fltk does not emulate (glutExtensionsSupported(), glutWire*(), +glutSolid*(), and glutStroke*()), you will also have to link with +-lglut, after -lFl. + +

Most of glut.H is inline functions. You should take a look at it +(and maybe at glut.C 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 3.3 distribution. + +

Known Problems

+ + + +

Mixing Glut code 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 show()n. + +

Don't call glutInit(). + +

Create your Fl_Window, and any fltk widgets. Leave a blank area in +the window for your glut window. + +

show() the Fl_Window. Perhaps call show(argc,argv). + +

Call window->begin() so the glut window will be automatically added +to it. + +

Use glutInitWindowSize() and glutInitWindowPosition() to set the +location in the parent window to put the glut window. + +

Put your glut code next. It probably does not need many changes. +Call window->end() immediately after the glutCreateWindow()! + +

You can call either glutMainLoop() or Fl::run() or loop calling +Fl::wait() to run the program. + +

class Fl_Glut_Window : public Fl_Gl_Window

+ +Each Glut window is an instance of this class, which is a subclass of +Fl_Gl_Window. 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 better +into FL's method of creating windows. + +

The current glut window is available in Fl_Glut_Window +*glut_window. + +

new Fl_Glut_Window(...) is the same as +glutCreateWindow() except it does not show() the window +or make the window current. + +

window->make_current() is the same as +glutSetWindow(number). If the window has not had show() +called on it yet, some functions that assumme a gl 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(). + + + -- cgit v1.2.3