From 367f908d8ed5a3464b9676223a26ddf4e11bdb5b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 7 Jan 1999 16:36:11 +0000 Subject: "Final" changes for first draft of 1.0 documentation. git-svn-id: file:///fltk/svn/fltk/trunk@187 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/glut.html | 231 +++++++++++++++++++++++++++++------------------- 1 file changed, 140 insertions(+), 91 deletions(-) (limited to 'documentation/glut.html') diff --git a/documentation/glut.html b/documentation/glut.html index 3cbfdb50e..643f66dc2 100644 --- a/documentation/glut.html +++ b/documentation/glut.html @@ -3,143 +3,192 @@

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. +This appendix describes the GLUT compatibility header file supplied with +FLTK. -

All files calling glut procedures must be compiled with C++. You may +

Using the GLUT Compatibility Header File

+ +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. +

You must link with the FLTK library. If you call any GLUT drawing +functions that FLTK does not emulate +(glutExtensionsSupported(), glutWire*(), +glutSolid*(), and glutStroke*()), you will also have +to link with the GLUT library (after the FLTK library!) -

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. +

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

Known Problems

+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: + +

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. + + + +
+ +

class Fl_Glut_Window

-

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. +

Class Hierarchy

-

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. +

Include Files

-

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 +

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 better -into FL's method of creating windows. +into FLTK's method of creating windows. -

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

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 +

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. +

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(). + +

Methods

+ + + +

Fl_Glut_Window::Fl_Glut_Window(int x, int y, int w, int h, const char *title = 0)
+Fl_Glut_Window::Fl_Glut_Window(int w, int h, const char *title = 0)

+ +The first constructor takes 4 int arguments to create the window with +a preset position and size. The second constructor with 2 arguments +will create the window with a preset size, but the window manager +will choose the position according to it's own whims. + +

virtual Fl_Glut_Window::~Fl_Glut_Window()

-

~Fl_Glut_Window() is the same as -glutDestroyWindow(). +Destroys the GLUT window. -- cgit v1.2.3