00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef Fl_glut_H
00041 # define Fl_glut_H
00042
00043 # include "gl.h"
00044
00045
00046 # include "Fl.H"
00047 # include "Fl_Gl_Window.H"
00048
00053 class FL_EXPORT Fl_Glut_Window : public Fl_Gl_Window {
00054 void _init();
00055 int mouse_down;
00056 protected:
00057 void draw();
00058 void draw_overlay();
00059 int handle(int);
00060 public:
00061 int number;
00062 int menu[3];
00063 void make_current();
00064 void (*display)();
00065 void (*overlaydisplay)();
00066 void (*reshape)(int w, int h);
00067 void (*keyboard)(uchar, int x, int y);
00068 void (*mouse)(int b, int state, int x, int y);
00069 void (*motion)(int x, int y);
00070 void (*passivemotion)(int x, int y);
00071 void (*entry)(int);
00072 void (*visibility)(int);
00073 void (*special)(int, int x, int y);
00074 Fl_Glut_Window(int w, int h, const char *);
00075 Fl_Glut_Window(int x, int y, int w, int h, const char *);
00076 ~Fl_Glut_Window();
00077 };
00078
00079 extern FL_EXPORT Fl_Glut_Window *glut_window;
00080 extern FL_EXPORT int glut_menu;
00081
00082
00083 extern FL_EXPORT void (*glut_idle_function)();
00084 extern FL_EXPORT void (*glut_menustate_function)(int);
00085 extern FL_EXPORT void (*glut_menustatus_function)(int,int,int);
00086
00088
00089
00090
00091 FL_EXPORT void glutInit(int *argcp, char **argv);
00092
00093 FL_EXPORT void glutInitDisplayMode(unsigned int mode);
00094
00095 # define GLUT_RGB FL_RGB
00096 # define GLUT_RGBA FL_RGB
00097 # define GLUT_INDEX FL_INDEX
00098 # define GLUT_SINGLE FL_SINGLE
00099 # define GLUT_DOUBLE FL_DOUBLE
00100 # define GLUT_ACCUM FL_ACCUM
00101 # define GLUT_ALPHA FL_ALPHA
00102 # define GLUT_DEPTH FL_DEPTH
00103 # define GLUT_STENCIL FL_STENCIL
00104 # define GLUT_MULTISAMPLE FL_MULTISAMPLE
00105 # define GLUT_STEREO FL_STEREO
00106
00107
00108 FL_EXPORT void glutInitWindowPosition(int x, int y);
00109
00110 FL_EXPORT void glutInitWindowSize(int w, int h);
00111
00112 FL_EXPORT void glutMainLoop();
00113
00114 FL_EXPORT int glutCreateWindow(char *title);
00115 FL_EXPORT int glutCreateWindow(const char *title);
00116
00117 FL_EXPORT int glutCreateSubWindow(int win, int x, int y, int width, int height);
00118
00119 FL_EXPORT void glutDestroyWindow(int win);
00120
00121 inline void glutPostRedisplay() {glut_window->redraw();}
00122
00123 FL_EXPORT void glutPostWindowRedisplay(int win);
00124
00125 FL_EXPORT void glutSwapBuffers();
00126
00127 inline int glutGetWindow() {return glut_window->number;}
00128
00129 FL_EXPORT void glutSetWindow(int win);
00130
00131 inline void glutSetWindowTitle(char *t) {glut_window->label(t);}
00132
00133 inline void glutSetIconTitle(char *t) {glut_window->iconlabel(t);}
00134
00135 inline void glutPositionWindow(int x, int y) {glut_window->position(x,y);}
00136
00137 inline void glutReshapeWindow(int w, int h) {glut_window->size(w,h);}
00138
00139 inline void glutPopWindow() {glut_window->show();}
00140
00141 inline void glutPushWindow() { }
00142
00143 inline void glutIconifyWindow() {glut_window->iconize();}
00144
00145 inline void glutShowWindow() {glut_window->show();}
00146
00147 inline void glutHideWindow() {glut_window->hide();}
00148
00149 inline void glutFullScreen() {glut_window->fullscreen();}
00150
00151 inline void glutSetCursor(Fl_Cursor cursor) {glut_window->cursor(cursor);}
00152
00153 # define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2)
00154 # define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67)
00155 # define GLUT_CURSOR_INFO FL_CURSOR_HAND
00156 # define GLUT_CURSOR_DESTROY ((Fl_Cursor)45)
00157 # define GLUT_CURSOR_HELP FL_CURSOR_HELP
00158 # define GLUT_CURSOR_CYCLE ((Fl_Cursor)26)
00159 # define GLUT_CURSOR_SPRAY ((Fl_Cursor)63)
00160 # define GLUT_CURSOR_WAIT FL_CURSOR_WAIT
00161 # define GLUT_CURSOR_TEXT FL_CURSOR_INSERT
00162 # define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS
00163 # define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS
00164 # define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE
00165 # define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N
00166 # define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S
00167 # define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W
00168 # define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E
00169 # define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW
00170 # define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE
00171 # define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE
00172 # define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW
00173 # define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT
00174 # define GLUT_CURSOR_NONE FL_CURSOR_NONE
00175 # define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS
00176
00177 inline void glutWarpPointer(int, int) { }
00178
00179 inline void glutEstablishOverlay() {glut_window->make_overlay_current();}
00180
00181 inline void glutRemoveOverlay() {glut_window->hide_overlay();}
00182
00183 inline void glutUseLayer(GLenum layer) {
00184 layer ? glut_window->make_overlay_current() : glut_window->make_current();}
00185 enum {GLUT_NORMAL, GLUT_OVERLAY};
00186
00187 inline void glutPostOverlayRedisplay() {glut_window->redraw_overlay();}
00188
00189 inline void glutShowOverlay() {glut_window->redraw_overlay();}
00190
00191 inline void glutHideOverlay() {glut_window->hide_overlay();}
00192
00193 FL_EXPORT int glutCreateMenu(void (*)(int));
00194
00195 FL_EXPORT void glutDestroyMenu(int menu);
00196
00197 inline int glutGetMenu() {return glut_menu;}
00198
00199 inline void glutSetMenu(int m) {glut_menu = m;}
00200
00201 FL_EXPORT void glutAddMenuEntry(char *label, int value);
00202
00203 FL_EXPORT void glutAddSubMenu(char *label, int submenu);
00204
00205 FL_EXPORT void glutChangeToMenuEntry(int item, char *labela, int value);
00206
00207 FL_EXPORT void glutChangeToSubMenu(int item, char *label, int submenu);
00208
00209 FL_EXPORT void glutRemoveMenuItem(int item);
00210
00211 inline void glutAttachMenu(int b) {glut_window->menu[b] = glut_menu;}
00212
00213 inline void glutDetachMenu(int b) {glut_window->menu[b] = 0;}
00214
00215 inline void glutDisplayFunc(void (*f)()) {glut_window->display = f;}
00216
00217 inline void glutReshapeFunc(void (*f)(int w, int h)) {glut_window->reshape=f;}
00218
00219 inline void glutKeyboardFunc(void (*f)(uchar key, int x, int y)) {
00220 glut_window->keyboard = f;}
00221
00222 inline void glutMouseFunc(void (*f)(int b, int state, int x, int y)) {
00223 glut_window->mouse = f;}
00224 # define GLUT_LEFT_BUTTON 0
00225 # define GLUT_MIDDLE_BUTTON 1
00226 # define GLUT_RIGHT_BUTTON 2
00227 # define GLUT_DOWN 0
00228 # define GLUT_UP 1
00229
00230 inline void glutMotionFunc(void (*f)(int x, int y)) {glut_window->motion= f;}
00231
00232 inline void glutPassiveMotionFunc(void (*f)(int x, int y)) {
00233 glut_window->passivemotion= f;}
00234
00235 inline void glutEntryFunc(void (*f)(int s)) {glut_window->entry = f;}
00236 enum {GLUT_LEFT, GLUT_ENTERED};
00237
00238 inline void glutVisibilityFunc(void (*f)(int s)) {glut_window->visibility=f;}
00239 enum {GLUT_NOT_VISIBLE, GLUT_VISIBLE};
00240
00241 FL_EXPORT void glutIdleFunc(void (*f)());
00242
00243
00244 inline void glutTimerFunc(unsigned int msec, void (*f)(int), int value) {
00245 Fl::add_timeout(msec*.001, (void (*)(void *))f, (void *)value);
00246 }
00247
00248 inline void glutMenuStateFunc(void (*f)(int state)) {
00249 glut_menustate_function = f;}
00250
00251 inline void glutMenuStatusFunc(void (*f)(int status, int x, int y)) {
00252 glut_menustatus_function = f;}
00253 enum {GLUT_MENU_NOT_IN_USE, GLUT_MENU_IN_USE};
00254
00255 inline void glutSpecialFunc(void (*f)(int key, int x, int y)) {
00256 glut_window->special = f;}
00257 # define GLUT_KEY_F1 1
00258 # define GLUT_KEY_F2 2
00259 # define GLUT_KEY_F3 3
00260 # define GLUT_KEY_F4 4
00261 # define GLUT_KEY_F5 5
00262 # define GLUT_KEY_F6 6
00263 # define GLUT_KEY_F7 7
00264 # define GLUT_KEY_F8 8
00265 # define GLUT_KEY_F9 9
00266 # define GLUT_KEY_F10 10
00267 # define GLUT_KEY_F11 11
00268 # define GLUT_KEY_F12 12
00269
00270 # define GLUT_KEY_LEFT FL_Left
00271 # define GLUT_KEY_UP FL_Up
00272 # define GLUT_KEY_RIGHT FL_Right
00273 # define GLUT_KEY_DOWN FL_Down
00274 # define GLUT_KEY_PAGE_UP FL_Page_Up
00275 # define GLUT_KEY_PAGE_DOWN FL_Page_Down
00276 # define GLUT_KEY_HOME FL_Home
00277 # define GLUT_KEY_END FL_End
00278 # define GLUT_KEY_INSERT FL_Insert
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294 inline void glutOverlayDisplayFunc(void (*f)()) {
00295 glut_window->overlaydisplay = f;}
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 FL_EXPORT int glutGet(GLenum type);
00313 enum {
00314 GLUT_RETURN_ZERO = 0,
00315 GLUT_WINDOW_X,
00316 GLUT_WINDOW_Y,
00317 GLUT_WINDOW_WIDTH,
00318 GLUT_WINDOW_HEIGHT,
00319 GLUT_WINDOW_PARENT,
00320 GLUT_SCREEN_WIDTH,
00321 GLUT_SCREEN_HEIGHT,
00322 GLUT_MENU_NUM_ITEMS,
00323 GLUT_DISPLAY_MODE_POSSIBLE,
00324 GLUT_INIT_WINDOW_X,
00325 GLUT_INIT_WINDOW_Y,
00326 GLUT_INIT_WINDOW_WIDTH,
00327 GLUT_INIT_WINDOW_HEIGHT,
00328 GLUT_INIT_DISPLAY_MODE,
00329 GLUT_WINDOW_BUFFER_SIZE,
00330 GLUT_VERSION
00331
00332
00333
00334
00335
00336 };
00337
00338 # define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS
00339 # define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS
00340 # define GLUT_WINDOW_RED_SIZE GL_RED_BITS
00341 # define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS
00342 # define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS
00343 # define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS
00344 # define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS
00345 # define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS
00346 # define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS
00347 # define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS
00348 # define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER
00349 # define GLUT_WINDOW_RGBA GL_RGBA
00350 # define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS
00351 # ifdef GL_SAMPLES_SGIS
00352 # define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS
00353 # else
00354 # define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO
00355 # endif
00356 # define GLUT_WINDOW_STEREO GL_STEREO
00357
00358 # define GLUT_HAS_KEYBOARD 600
00359 # define GLUT_HAS_MOUSE 601
00360 # define GLUT_HAS_SPACEBALL 602
00361 # define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
00362 # define GLUT_HAS_TABLET 604
00363 # define GLUT_NUM_MOUSE_BUTTONS 605
00364 # define GLUT_NUM_SPACEBALL_BUTTONS 606
00365 # define GLUT_NUM_BUTTON_BOX_BUTTONS 607
00366 # define GLUT_NUM_DIALS 608
00367 # define GLUT_NUM_TABLET_BUTTONS 609
00368 FL_EXPORT int glutDeviceGet(GLenum type);
00369
00370
00371 # define GLUT_ACTIVE_SHIFT FL_SHIFT
00372 # define GLUT_ACTIVE_CTRL FL_CTRL
00373 # define GLUT_ACTIVE_ALT FL_ALT
00374 inline int glutGetModifiers() {return Fl::event_state() & (GLUT_ACTIVE_SHIFT | GLUT_ACTIVE_CTRL | GLUT_ACTIVE_ALT);}
00375
00376 FL_EXPORT int glutLayerGet(GLenum);
00377 # define GLUT_OVERLAY_POSSIBLE 800
00378
00379
00380 # define GLUT_TRANSPARENT_INDEX 803
00381 # define GLUT_NORMAL_DAMAGED 804
00382 # define GLUT_OVERLAY_DAMAGED 805
00383
00384 extern "C" {
00385 typedef void (*GLUTproc)();
00386 }
00387
00388 FL_EXPORT GLUTproc glutGetProcAddress(const char *procName);
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00412 struct Fl_Glut_Bitmap_Font {Fl_Font font; Fl_Fontsize size;};
00413
00414 extern FL_EXPORT struct Fl_Glut_Bitmap_Font
00415 glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
00416 glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
00417 glutBitmapHelvetica18;
00418 # define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
00419 # define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
00420 # define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
00421 # define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
00422 # define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
00423 # define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
00424 # define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
00425
00426 FL_EXPORT void glutBitmapCharacter(void *font, int character);
00427 FL_EXPORT int glutBitmapHeight(void *font);
00428 FL_EXPORT int glutBitmapLength(void *font, const unsigned char *string);
00429 FL_EXPORT void glutBitmapString(void *font, const unsigned char *string);
00430 FL_EXPORT int glutBitmapWidth(void *font, int character);
00431
00432 FL_EXPORT int glutExtensionSupported(char *name);
00433
00434
00435 struct Fl_Glut_StrokeVertex {
00436 GLfloat X, Y;
00437 };
00438
00439 struct Fl_Glut_StrokeStrip {
00440 int Number;
00441 const Fl_Glut_StrokeVertex* Vertices;
00442 };
00443
00444 struct Fl_Glut_StrokeChar {
00445 GLfloat Right;
00446 int Number;
00447 const Fl_Glut_StrokeStrip* Strips;
00448 };
00449
00450 struct Fl_Glut_StrokeFont {
00451 char* Name;
00452 int Quantity;
00453 GLfloat Height;
00454 const Fl_Glut_StrokeChar** Characters;
00455 };
00456 extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeRoman;
00457 extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeMonoRoman;
00458 # define GLUT_STROKE_ROMAN (&glutStrokeRoman)
00459 # define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
00460
00461 FL_EXPORT void glutStrokeCharacter(void *font, int character);
00462 FL_EXPORT GLfloat glutStrokeHeight(void *font);
00463 FL_EXPORT int glutStrokeLength(void *font, const unsigned char *string);
00464 FL_EXPORT void glutStrokeString(void *font, const unsigned char *string);
00465 FL_EXPORT int glutStrokeWidth(void *font, int character);
00466
00467
00468 FL_EXPORT void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
00469 FL_EXPORT void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
00470 FL_EXPORT void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
00471 FL_EXPORT void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
00472 FL_EXPORT void glutWireCube(GLdouble size);
00473 FL_EXPORT void glutSolidCube(GLdouble size);
00474 FL_EXPORT void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
00475 FL_EXPORT void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
00476 FL_EXPORT void glutWireDodecahedron();
00477 FL_EXPORT void glutSolidDodecahedron();
00478 FL_EXPORT void glutWireTeapot(GLdouble size);
00479 FL_EXPORT void glutSolidTeapot(GLdouble size);
00480 FL_EXPORT void glutWireOctahedron();
00481 FL_EXPORT void glutSolidOctahedron();
00482 FL_EXPORT void glutWireTetrahedron();
00483 FL_EXPORT void glutSolidTetrahedron();
00484 FL_EXPORT void glutWireIcosahedron();
00485 FL_EXPORT void glutSolidIcosahedron();
00486
00487 #endif // !Fl_glut_H
00488
00489
00490
00491