00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef Fl_Gl_Window_H
00023 #define Fl_Gl_Window_H
00024
00025 #include "Fl_Window.H"
00026
00027 #ifndef GLContext
00028
00031 typedef void* GLContext;
00032 #endif
00033
00034 class Fl_Gl_Choice;
00035
00056 class FL_EXPORT Fl_Gl_Window : public Fl_Window {
00057
00058 int mode_;
00059 const int *alist;
00060 Fl_Gl_Choice *g;
00061 GLContext context_;
00062 char valid_f_;
00063 char damage1_;
00064 virtual void draw_overlay();
00065 void init();
00066
00067 void *overlay;
00068 void make_overlay();
00069 friend class _Fl_Gl_Overlay;
00070
00071 static int can_do(int, const int *);
00072 int mode(int, const int *);
00073 static int gl_plugin_linkage();
00074
00075 public:
00076
00077 void show();
00078 void show(int a, char **b) {Fl_Window::show(a,b);}
00079 void flush();
00080 void hide();
00081 void resize(int,int,int,int);
00082 int handle(int);
00083
00108 char valid() const {return valid_f_ & 1;}
00112 void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
00113 void invalidate();
00114
00121 char context_valid() const {return valid_f_ & 2;}
00125 void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
00126
00128 static int can_do(int m) {return can_do(m,0);}
00131 static int can_do(const int *m) {return can_do(0, m);}
00133 int can_do() {return can_do(mode_,alist);}
00137 Fl_Mode mode() const {return (Fl_Mode)mode_;}
00178 int mode(int a) {return mode(a,0);}
00190 int mode(const int *a) {return mode(0, a);}
00193 void* context() const {return context_;}
00194 void context(void*, int destroy_flag = 0);
00195 void make_current();
00196 void swap_buffers();
00197 void ortho();
00198
00204 int can_do_overlay();
00211 void redraw_overlay();
00212 void hide_overlay();
00220 void make_overlay_current();
00221
00222
00223 virtual Fl_Gl_Window* as_gl_window() {return this;}
00224
00234 #ifdef __APPLE__
00235 float pixels_per_unit();
00236 #else
00237 float pixels_per_unit() { return 1; }
00238 #endif
00239
00246 int pixel_w() { return int(pixels_per_unit() * w() + 0.5); }
00254 int pixel_h() { return int(pixels_per_unit() * h() + 0.5); }
00255
00256 ~Fl_Gl_Window();
00261 Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
00268 Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
00269 : Fl_Window(X,Y,W,H,l) {init();}
00270
00271 protected:
00277 virtual void draw();
00278 };
00279
00280 #endif
00281
00282
00283
00284