FLTK 1.3.2
Fl_Gl_Window.H
1 //
2 // "$Id: Fl_Gl_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
3 //
4 // OpenGL header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 /* \file
20  Fl_Gl_Window widget . */
21 
22 #ifndef Fl_Gl_Window_H
23 #define Fl_Gl_Window_H
24 
25 #include "Fl_Window.H"
26 
27 #ifndef GLContext
28 
31 typedef void* GLContext; // actually a GLXContext or HGLDC
32 #endif
33 
34 class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
35 
56 class FL_EXPORT Fl_Gl_Window : public Fl_Window {
57 
58  int mode_;
59  const int *alist;
60  Fl_Gl_Choice *g;
61  GLContext context_;
62  char valid_f_;
63  char damage1_; // damage() of back buffer
64  virtual void draw_overlay();
65  void init();
66 
67  void *overlay;
68  void make_overlay();
69  friend class _Fl_Gl_Overlay;
70 
71  static int can_do(int, const int *);
72  int mode(int, const int *);
73 
74 public:
75 
76  void show();
77  void show(int a, char **b) {Fl_Window::show(a,b);}
78  void flush();
79  void hide();
80  void resize(int,int,int,int);
81  int handle(int);
82 
107  char valid() const {return valid_f_ & 1;}
111  void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
112  void invalidate();
113 
120  char context_valid() const {return valid_f_ & 2;}
124  void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
125 
127  static int can_do(int m) {return can_do(m,0);}
129  static int can_do(const int *m) {return can_do(0, m);}
131  int can_do() {return can_do(mode_,alist);}
165  Fl_Mode mode() const {return (Fl_Mode)mode_;}
167  int mode(int a) {return mode(a,0);}
169  int mode(const int *a) {return mode(0, a);}
171  void* context() const {return context_;}
172  void context(void*, int destroy_flag = 0);
173  void make_current();
174  void swap_buffers();
175  void ortho();
176 
182  int can_do_overlay();
189  void redraw_overlay();
190  void hide_overlay();
198  void make_overlay_current();
199 
200  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
201  virtual Fl_Gl_Window* as_gl_window() {return this;}
202 
203  ~Fl_Gl_Window();
208  Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
215  Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
216  : Fl_Window(X,Y,W,H,l) {init();}
217 
218 protected:
224  virtual void draw();
225 };
226 
227 #endif
228 
229 //
230 // End of "$Id: Fl_Gl_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
231 //