Update documentation and move glutDeviceGet() into code so we can return

the correct value for GLUT_NUM_MOUSE_BUTTONS.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5652 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2007-02-01 21:11:20 +00:00
parent eef6353369
commit 85c2e38825
3 changed files with 17 additions and 24 deletions

View File

@ -370,7 +370,7 @@ enum {
# define GLUT_NUM_BUTTON_BOX_BUTTONS 607
# define GLUT_NUM_DIALS 608
# define GLUT_NUM_TABLET_BUTTONS 609
inline int glutDeviceGet(GLenum type) { return type <= GLUT_HAS_MOUSE; }
FL_EXPORT int glutDeviceGet(GLenum type);
// WARNING: these values are different than GLUT uses:
# define GLUT_ACTIVE_SHIFT FL_SHIFT

View File

@ -4,30 +4,14 @@
</HEAD>
<BODY>
<H1 ALIGN=RIGHT><A NAME=glut>D - GLUT Compatibility</A></H1>
This appendix describes the GLUT compatibility header file supplied
with FLTK.
<P>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.</P>
<H2>Using the GLUT Compatibility Header File</H2>
You should be able to compile existing GLUT source code by including <TT>
&lt;FL/glut.H&gt;</TT> instead of <TT>&lt;GL/glut.h&gt;</TT>. This can be done by
editing the source, by changing the <TT>-I</TT> switches to the
compiler, or by providing a symbolic link from <TT>GL/glut.h</TT> to <TT>
FL/glut.H</TT>.
<P><I>All files calling GLUT procedures must be compiled with C++</I>.
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. </P>
<P>You must link with the FLTK library. If you call any GLUT drawing
functions that FLTK does not emulate (<TT>glutExtensionsSupported()</TT>
, <TT>glutWire*()</TT>, <TT>glutSolid*()</TT>, and <TT>glutStroke*()</TT>
), you will also have to link with the GLUT library (<I>after</I> the
FLTK library!) </P>
<P>Most of <TT>FL/glut.H</TT> is inline functions. You should take a
look at it (and maybe at <TT>test/glpuzzle.cxx</TT> in the FLTK source) if
you are having trouble porting your GLUT program. </P>
<P>This has been tested with most of the demo programs that come with
the GLUT 3.3 distribution. </P>
<P>You should be able to compile existing GLUT source code by including <TT>&lt;FL/glut.H&gt;</TT> instead of <TT>&lt;GL/glut.h&gt;</TT>. This can be done by editing the source, by changing the <TT>-I</TT> switches to the compiler, or by providing a symbolic link from <TT>GL/glut.h</TT> to <TT>FL/glut.H</TT>.</P>
<P><I>All files calling GLUT procedures must be compiled with C++</I>. 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.</P>
<P>You must link with the FLTK library. Most of <TT>FL/glut.H</TT> is inline functions. You should take a look at it (and maybe at <TT>test/glpuzzle.cxx</TT> in the FLTK source) if you are having trouble porting your GLUT program. </P>
<P>This has been tested with most of the demo programs that come with the GLUT and FreeGLUT distributions.</P>
<H2>Known Problems</H2>
The following functions and/or arguments to functions are missing, and
<P>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:
<UL>
@ -37,7 +21,7 @@ compile:
<LI><TT>glutInitDisplayMode(GLUT_LUMINANCE)</TT></LI>
<LI><TT>glutPushWindow()</TT></LI>
<LI><TT>glutWarpPointer()</TT></LI>
<LI>Spaceball, buttonbox, dials, tablet functions, <TT>glutDeviceGet()</TT>
<LI>Spaceball, buttonbox, dials, tablet functions</TT>
</LI>
<LI><TT>glutWindowStatusFunc()</TT></LI>
<LI><TT>glutGet(GLUT_WINDOW_NUM_CHILDREN)</TT></LI>

View File

@ -423,6 +423,15 @@ int glutLayerGet(GLenum type) {
}
}
int glutDeviceGet(GLenum type) {
switch (type) {
case GLUT_HAS_KEYBOARD : return 1;
case GLUT_HAS_MOUSE : return 1;
case GLUT_NUM_MOUSE_BUTTONS : return 3;
default : return 0;
}
}
// Get extension function address...
GLUTproc glutGetProcAddress(const char *procName) {
# ifdef WIN32