FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // OpenGL header file for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software. Distribution and use rights are outlined in 00009 // the file "COPYING" which should have been included with this file. If this 00010 // file is missing or damaged, see the license at: 00011 // 00012 // http://www.fltk.org/COPYING.php 00013 // 00014 // Please report all bugs and problems on the following page: 00015 // 00016 // http://www.fltk.org/str.php 00017 // 00018 00019 /* \file 00020 Fl_Gl_Window widget . */ 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; // actually a GLXContext or HGLDC 00032 #endif 00033 00034 class Fl_Gl_Choice; // structure to hold result of glXChooseVisual 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_; // damage() of back buffer 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 00074 public: 00075 00076 void show(); 00077 void show(int a, char **b) {Fl_Window::show(a,b);} 00078 void flush(); 00079 void hide(); 00080 void resize(int,int,int,int); 00081 int handle(int); 00082 00107 char valid() const {return valid_f_ & 1;} 00111 void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;} 00112 void invalidate(); 00113 00120 char context_valid() const {return valid_f_ & 2;} 00124 void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;} 00125 00127 static int can_do(int m) {return can_do(m,0);} 00129 static int can_do(const int *m) {return can_do(0, m);} 00131 int can_do() {return can_do(mode_,alist);} 00165 Fl_Mode mode() const {return (Fl_Mode)mode_;} 00167 int mode(int a) {return mode(a,0);} 00169 int mode(const int *a) {return mode(0, a);} 00171 void* context() const {return context_;} 00172 void context(void*, int destroy_flag = 0); 00173 void make_current(); 00174 void swap_buffers(); 00175 void ortho(); 00176 00182 int can_do_overlay(); 00189 void redraw_overlay(); 00190 void hide_overlay(); 00198 void make_overlay_current(); 00199 00200 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. 00201 virtual Fl_Gl_Window* as_gl_window() {return this;} 00202 00203 ~Fl_Gl_Window(); 00208 Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();} 00215 Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0) 00216 : Fl_Window(X,Y,W,H,l) {init();} 00217 00218 protected: 00224 virtual void draw(); 00225 }; 00226 00227 #endif 00228 00229 // 00230 // End of "$Id$". 00231 //