• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Gl_Window.H

00001 //
00002 // "$Id$"
00003 //
00004 // OpenGL header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2015 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   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   // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
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 // End of "$Id$".
00284 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.