From cd5c9b874325a474ef77b0cf9e7327116a871226 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 4 Dec 2002 04:44:54 +0000 Subject: OSX fixes for GLUT/GL window classes. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2859 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/glut.H | 246 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 123 insertions(+), 123 deletions(-) (limited to 'FL/glut.H') diff --git a/FL/glut.H b/FL/glut.H index 80d27166c..0ca36a9c1 100644 --- a/FL/glut.H +++ b/FL/glut.H @@ -1,5 +1,5 @@ // -// "$Id: glut.H,v 1.6.2.10.2.3 2002/08/14 16:49:38 easysw Exp $" +// "$Id: glut.H,v 1.6.2.10.2.4 2002/12/04 04:44:54 easysw Exp $" // // GLUT emulation header file for the Fast Light Tool Kit (FLTK). // @@ -23,7 +23,7 @@ // Please report all bugs and problems to "fltk-bugs@fltk.org". // -// Emulation of Glut using fltk. +// Emulation of GLUT using fltk. // GLUT is Copyright (c) Mark J. Kilgard, 1994, 1995, 1996: // "This program is freely distributable without licensing fees and is @@ -31,28 +31,28 @@ // program is -not- in the public domain." // Although I have copied the GLUT API, none of my code is based on -// any Glut implementation details and is therefore covered by the LGPL. +// any GLUT implementation details and is therefore covered by the LGPL. -// Fltk does not include the Glut drawing functions (such as +// FLTK does not include the GLUT drawing functions (such as // glutWireTeapot()) or the stroke fonts but the declarations for the // drawing functions are included here because otherwise there is no // way to get them along with this. To use them you will have to -// link in the original Glut library, put -lglut *after* -lfltk. +// link in the original GLUT library, put -lglut *after* -lfltk. -// Commented out lines indicate parts of Glut that are not emulated. +// Commented out lines indicate parts of GLUT that are not emulated. #ifndef __glut_h__ -#define __glut_h__ +# define __glut_h__ -#include -//#include +# include "gl.h" +//# include //////////////////////////////////////////////////////////////// -// Glut is emulated using this window class and these static variables +// GLUT is emulated using this window class and these static variables // (plus several more static variables hidden in glut.C): -#include "Fl.H" -#include "Fl_Gl_Window.H" +# include "Fl.H" +# include "Fl_Gl_Window.H" class FL_EXPORT Fl_Glut_Window : public Fl_Gl_Window { void _init(); @@ -90,24 +90,24 @@ extern FL_EXPORT void (*glut_menustatus_function)(int,int,int); //////////////////////////////////////////////////////////////// -//#define GLUT_API_VERSION This does not match any version of Glut exactly... +//# define GLUT_API_VERSION This does not match any version of GLUT exactly... FL_EXPORT void glutInit(int *argcp, char **argv); // creates first window FL_EXPORT void glutInitDisplayMode(unsigned int mode); // the FL_ symbols have the same value as the GLUT ones: -#define GLUT_RGB FL_RGB -#define GLUT_RGBA FL_RGB -#define GLUT_INDEX FL_INDEX -#define GLUT_SINGLE FL_SINGLE -#define GLUT_DOUBLE FL_DOUBLE -#define GLUT_ACCUM FL_ACCUM -#define GLUT_ALPHA FL_ALPHA -#define GLUT_DEPTH FL_DEPTH -#define GLUT_STENCIL FL_STENCIL -#define GLUT_MULTISAMPLE FL_MULTISAMPLE -#define GLUT_STEREO FL_STEREO -// #define GLUT_LUMINANCE 512 +# define GLUT_RGB FL_RGB +# define GLUT_RGBA FL_RGB +# define GLUT_INDEX FL_INDEX +# define GLUT_SINGLE FL_SINGLE +# define GLUT_DOUBLE FL_DOUBLE +# define GLUT_ACCUM FL_ACCUM +# define GLUT_ALPHA FL_ALPHA +# define GLUT_DEPTH FL_DEPTH +# define GLUT_STENCIL FL_STENCIL +# define GLUT_MULTISAMPLE FL_MULTISAMPLE +# define GLUT_STEREO FL_STEREO +// # define GLUT_LUMINANCE 512 FL_EXPORT void glutInitWindowPosition(int x, int y); @@ -151,29 +151,29 @@ inline void glutFullScreen() {glut_window->fullscreen();} inline void glutSetCursor(Fl_Cursor cursor) {glut_window->cursor(cursor);} // notice that the numeric values are different than glut: -#define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2) -#define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67) -#define GLUT_CURSOR_INFO FL_CURSOR_HAND -#define GLUT_CURSOR_DESTROY ((Fl_Cursor)45) -#define GLUT_CURSOR_HELP FL_CURSOR_HELP -#define GLUT_CURSOR_CYCLE ((Fl_Cursor)26) -#define GLUT_CURSOR_SPRAY ((Fl_Cursor)63) -#define GLUT_CURSOR_WAIT FL_CURSOR_WAIT -#define GLUT_CURSOR_TEXT FL_CURSOR_INSERT -#define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS -#define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS -#define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE -#define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N -#define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S -#define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W -#define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E -#define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW -#define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE -#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE -#define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW -#define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT -#define GLUT_CURSOR_NONE FL_CURSOR_NONE -#define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS +# define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2) +# define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67) +# define GLUT_CURSOR_INFO FL_CURSOR_HAND +# define GLUT_CURSOR_DESTROY ((Fl_Cursor)45) +# define GLUT_CURSOR_HELP FL_CURSOR_HELP +# define GLUT_CURSOR_CYCLE ((Fl_Cursor)26) +# define GLUT_CURSOR_SPRAY ((Fl_Cursor)63) +# define GLUT_CURSOR_WAIT FL_CURSOR_WAIT +# define GLUT_CURSOR_TEXT FL_CURSOR_INSERT +# define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS +# define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS +# define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE +# define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N +# define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S +# define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W +# define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E +# define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW +# define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE +# define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE +# define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW +# define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT +# define GLUT_CURSOR_NONE FL_CURSOR_NONE +# define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS //inline void glutWarpPointer(int x, int y); @@ -222,11 +222,11 @@ inline void glutKeyboardFunc(void (*f)(uchar key, int x, int y)) { inline void glutMouseFunc(void (*f)(int b, int state, int x, int y)) { glut_window->mouse = f;} -#define GLUT_LEFT_BUTTON 0 -#define GLUT_MIDDLE_BUTTON 1 -#define GLUT_RIGHT_BUTTON 2 -#define GLUT_DOWN 0 -#define GLUT_UP 1 +# define GLUT_LEFT_BUTTON 0 +# define GLUT_MIDDLE_BUTTON 1 +# define GLUT_RIGHT_BUTTON 2 +# define GLUT_DOWN 0 +# define GLUT_UP 1 inline void glutMotionFunc(void (*f)(int x, int y)) {glut_window->motion= f;} @@ -255,28 +255,28 @@ enum {GLUT_MENU_NOT_IN_USE, GLUT_MENU_IN_USE}; inline void glutSpecialFunc(void (*f)(int key, int x, int y)) { glut_window->special = f;} -#define GLUT_KEY_F1 1 -#define GLUT_KEY_F2 2 -#define GLUT_KEY_F3 3 -#define GLUT_KEY_F4 4 -#define GLUT_KEY_F5 5 -#define GLUT_KEY_F6 6 -#define GLUT_KEY_F7 7 -#define GLUT_KEY_F8 8 -#define GLUT_KEY_F9 9 -#define GLUT_KEY_F10 10 -#define GLUT_KEY_F11 11 -#define GLUT_KEY_F12 12 -// WARNING: Different values than Glut uses: -#define GLUT_KEY_LEFT FL_Left -#define GLUT_KEY_UP FL_Up -#define GLUT_KEY_RIGHT FL_Right -#define GLUT_KEY_DOWN FL_Down -#define GLUT_KEY_PAGE_UP FL_Page_Up -#define GLUT_KEY_PAGE_DOWN FL_Page_Down -#define GLUT_KEY_HOME FL_Home -#define GLUT_KEY_END FL_End -#define GLUT_KEY_INSERT FL_Insert +# define GLUT_KEY_F1 1 +# define GLUT_KEY_F2 2 +# define GLUT_KEY_F3 3 +# define GLUT_KEY_F4 4 +# define GLUT_KEY_F5 5 +# define GLUT_KEY_F6 6 +# define GLUT_KEY_F7 7 +# define GLUT_KEY_F8 8 +# define GLUT_KEY_F9 9 +# define GLUT_KEY_F10 10 +# define GLUT_KEY_F11 11 +# define GLUT_KEY_F12 12 +// WARNING: Different values than GLUT uses: +# define GLUT_KEY_LEFT FL_Left +# define GLUT_KEY_UP FL_Up +# define GLUT_KEY_RIGHT FL_Right +# define GLUT_KEY_DOWN FL_Down +# define GLUT_KEY_PAGE_UP FL_Page_Up +# define GLUT_KEY_PAGE_DOWN FL_Page_Down +# define GLUT_KEY_HOME FL_Home +# define GLUT_KEY_END FL_End +# define GLUT_KEY_INSERT FL_Insert //inline void glutSpaceballMotionFunc(void (*)(int x, int y, int z)); @@ -308,7 +308,7 @@ inline void glutOverlayDisplayFunc(void (*f)()) { //inline void glutCopyColormap(int win); -// Warning: values are changed from Glut! +// Warning: values are changed from GLUT! // Also relies on the GL_ symbols having values greater than 100 int glutGet(GLenum type); enum { @@ -335,25 +335,25 @@ enum { GLUT_WINDOW_BUFFER_SIZE }; -#define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS -#define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS -#define GLUT_WINDOW_RED_SIZE GL_RED_BITS -#define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS -#define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS -#define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS -#define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS -#define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS -#define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS -#define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS -#define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER -#define GLUT_WINDOW_RGBA GL_RGBA -#define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS -#ifdef GL_SAMPLES_SGIS -#define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS -#else -#define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO -#endif -#define GLUT_WINDOW_STEREO GL_STEREO +# define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS +# define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS +# define GLUT_WINDOW_RED_SIZE GL_RED_BITS +# define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS +# define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS +# define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS +# define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS +# define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS +# define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS +# define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS +# define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER +# define GLUT_WINDOW_RGBA GL_RGBA +# define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS +# ifdef GL_SAMPLES_SGIS +# define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS +# else +# define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO +# endif +# define GLUT_WINDOW_STEREO GL_STEREO //int glutDeviceGet(GLenum type); //#define GLUT_HAS_KEYBOARD 600 @@ -368,18 +368,18 @@ enum { //#define GLUT_NUM_TABLET_BUTTONS 609 inline int glutGetModifiers() {return Fl::event_state();} -// WARNING: these values are different than Glut uses: -#define GLUT_ACTIVE_SHIFT FL_SHIFT -#define GLUT_ACTIVE_CTRL FL_CTRL -#define GLUT_ACTIVE_ALT FL_ALT +// WARNING: these values are different than GLUT uses: +# define GLUT_ACTIVE_SHIFT FL_SHIFT +# define GLUT_ACTIVE_CTRL FL_CTRL +# define GLUT_ACTIVE_ALT FL_ALT int glutLayerGet(GLenum); -#define GLUT_OVERLAY_POSSIBLE 800 +# define GLUT_OVERLAY_POSSIBLE 800 //#define GLUT_LAYER_IN_USE 801 //#define GLUT_HAS_OVERLAY 802 -#define GLUT_TRANSPARENT_INDEX 803 -#define GLUT_NORMAL_DAMAGED 804 -#define GLUT_OVERLAY_DAMAGED 805 +# define GLUT_TRANSPARENT_INDEX 803 +# define GLUT_NORMAL_DAMAGED 804 +# define GLUT_OVERLAY_DAMAGED 805 //inline int glutVideoResizeGet(GLenum param); //#define GLUT_VIDEO_RESIZE_POSSIBLE 900 @@ -402,28 +402,28 @@ int glutLayerGet(GLenum); //inline void glutVideoPan(int x, int y, int width, int height); //////////////////////////////////////////////////////////////// -// Emulated Glut drawing functions: +// Emulated GLUT drawing functions: // Font argument must be a void* for compatability, so... extern FL_EXPORT struct Glut_Bitmap_Font {uchar font; int size;} glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18; -#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) -#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) -#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) -#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) -#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) -#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) -#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) +# define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) +# define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) +# define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) +# define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) +# define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) +# define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) +# define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) FL_EXPORT void glutBitmapCharacter(void *font, int character); FL_EXPORT int glutBitmapWidth(void *font, int character); //////////////////////////////////////////////////////////////// -// Glut drawing functions. These are NOT emulated but you can -// link in the glut library to get them. This assummes the object -// files in Glut remain as they currently are so that there are +// GLUT drawing functions. These are NOT emulated but you can +// link in the glut library to get them. This assumes the object +// files in GLUT remain as they currently are so that there are // not symbol conflicts with the above. extern "C" { @@ -431,15 +431,15 @@ extern "C" { extern int APIENTRY glutExtensionSupported(char *name); /* Stroke font constants (use these in GLUT program). */ -#ifdef WIN32 -# define GLUT_STROKE_ROMAN ((void*)0) -# define GLUT_STROKE_MONO_ROMAN ((void*)1) -#else +# ifdef WIN32 +# define GLUT_STROKE_ROMAN ((void*)0) +# define GLUT_STROKE_MONO_ROMAN ((void*)1) +# else extern void *glutStrokeRoman; -# define GLUT_STROKE_ROMAN (&glutStrokeRoman) +# define GLUT_STROKE_ROMAN (&glutStrokeRoman) extern void *glutStrokeMonoRoman; -# define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) -#endif +# define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) +# endif /* GLUT font sub-API */ extern void APIENTRY glutStrokeCharacter(void *font, int character); @@ -467,8 +467,8 @@ extern void APIENTRY glutSolidIcosahedron(); } -#endif /* __glut_h__ */ +#endif /* !__glut_h__ */ // -// End of "$Id: glut.H,v 1.6.2.10.2.3 2002/08/14 16:49:38 easysw Exp $". +// End of "$Id: glut.H,v 1.6.2.10.2.4 2002/12/04 04:44:54 easysw Exp $". // -- cgit v1.2.3