FLTK 1.3.0
Fl_Gl_Window.H
00001 //
00002 // "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
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; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 /* \file
00029    Fl_Gl_Window widget . */
00030 
00031 #ifndef Fl_Gl_Window_H
00032 #define Fl_Gl_Window_H
00033 
00034 #include "Fl_Window.H"
00035 
00036 #ifndef GLContext
00037 
00040 typedef void* GLContext; // actually a GLXContext or HGLDC
00041 #endif
00042 
00043 class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
00044 
00065 class FL_EXPORT Fl_Gl_Window : public Fl_Window {
00066 
00067   int mode_;
00068   const int *alist;
00069   Fl_Gl_Choice *g;
00070   GLContext context_;
00071   char valid_f_;
00072   char damage1_; // damage() of back buffer
00073   virtual void draw_overlay();
00074   void init();
00075 
00076   void *overlay;
00077   void make_overlay();
00078   friend class _Fl_Gl_Overlay;
00079 
00080   static int can_do(int, const int *);
00081   int mode(int, const int *);
00082 
00083 public:
00084 
00085   void show();
00086   void show(int a, char **b) {Fl_Window::show(a,b);}
00087   void flush();
00088   void hide();
00089   void resize(int,int,int,int);
00090   int handle(int);
00091   
00116   char valid() const {return valid_f_ & 1;}
00120   void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
00121   void invalidate();
00122 
00129   char context_valid() const {return valid_f_ & 2;}
00133   void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
00134 
00136   static int can_do(int m) {return can_do(m,0);}
00138   static int can_do(const int *m) {return can_do(0, m);}
00140   int can_do() {return can_do(mode_,alist);}
00174   Fl_Mode mode() const {return (Fl_Mode)mode_;}
00176   int mode(int a) {return mode(a,0);}
00178   int mode(const int *a) {return mode(0, a);}
00180   void* context() const {return context_;}
00181   void context(void*, int destroy_flag = 0);
00182   void make_current();
00183   void swap_buffers();
00184   void ortho();
00185 
00191   int can_do_overlay();
00198   void redraw_overlay();
00199   void hide_overlay();
00207   void make_overlay_current();
00208 
00209   // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
00210   virtual Fl_Gl_Window* as_gl_window() {return this;}
00211   
00212   ~Fl_Gl_Window();
00217   Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
00224   Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
00225     : Fl_Window(X,Y,W,H,l) {init();}
00226 
00227 protected:
00233   virtual void draw();
00234 };
00235 
00236 #endif
00237 
00238 //
00239 // End of "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
00240 //