NTK 1.3.0
Fl_Gl_Window.H
1//
2// "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
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; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public
10// License as published by the Free Software Foundation; either
11// version 2 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Library General Public License for more details.
17//
18// You should have received a copy of the GNU Library General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21// USA.
22//
23// Please report all bugs and problems on the following page:
24//
25// http://www.fltk.org/str.php
26//
27
28/* \file
29 Fl_Gl_Window widget . */
30
31#ifndef Fl_Gl_Window_H
32#define Fl_Gl_Window_H
33
34#include "Fl_Window.H"
35
36#ifndef GLContext
40typedef void* GLContext; // actually a GLXContext or HGLDC
41#endif
42
43class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
44
65class FL_EXPORT Fl_Gl_Window : public Fl_Window {
66
67 int mode_;
68 const int *alist;
69 Fl_Gl_Choice *g;
70 GLContext context_;
71 char valid_f_;
72 char damage1_; // damage() of back buffer
73 virtual void draw_overlay();
74 void init();
75
76 void *overlay;
77 void make_overlay();
78 friend class _Fl_Gl_Overlay;
79
80 static int can_do(int, const int *);
81 int mode(int, const int *);
82
83public:
84
85 void show();
86 void show(int a, char **b) {Fl_Window::show(a,b);}
87 void flush();
88 void hide();
89 void resize(int,int,int,int);
90 int handle(int);
91
116 char valid() const {return valid_f_ & 1;}
120 void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
121 void invalidate();
122
129 char context_valid() const {return valid_f_ & 2;}
133 void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
134
136 static int can_do(int m) {return can_do(m,0);}
138 static int can_do(const int *m) {return can_do(0, m);}
140 int can_do() {return can_do(mode_,alist);}
174 Fl_Mode mode() const {return (Fl_Mode)mode_;}
176 int mode(int a) {return mode(a,0);}
178 int mode(const int *a) {return mode(0, a);}
180 void* context() const {return context_;}
181 void context(void*, int destroy_flag = 0);
182 void make_current();
183 void swap_buffers();
184 void ortho();
185
191 int can_do_overlay();
198 void redraw_overlay();
199 void hide_overlay();
207 void make_overlay_current();
208
209 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
210 virtual Fl_Gl_Window* as_gl_window() {return this;}
211
217 Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
224 Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
225 : Fl_Window(X,Y,W,H,l) {init();}
226
227protected:
233 virtual void draw();
234};
235
236#endif
237
238//
239// End of "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
240//
Fl_Mode
visual types and Fl_Gl_Window::mode() (values match Glut)
Definition: Enumerations.H:914
Definition: Fl_Gl_Choice.H:73
The Fl_Gl_Window widget sets things up so OpenGL works.
Definition: Fl_Gl_Window.H:65
char context_valid() const
Will only be set if the OpenGL context is created or recreated.
Definition: Fl_Gl_Window.H:129
int can_do()
Returns non-zero if the hardware supports the given or current OpenGL mode.
Definition: Fl_Gl_Window.H:140
static int can_do(int m)
Returns non-zero if the hardware supports the given or current OpenGL mode.
Definition: Fl_Gl_Window.H:136
int mode(const int *a)
See Fl_Mode mode() const.
Definition: Fl_Gl_Window.H:178
virtual Fl_Gl_Window * as_gl_window()
Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
Definition: Fl_Gl_Window.H:210
void * context() const
void See void context(void* v, int destroy_flag)
Definition: Fl_Gl_Window.H:180
Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
Creates a new Fl_Gl_Window widget using the given position, size, and label string.
Definition: Fl_Gl_Window.H:224
static int can_do(const int *m)
Returns non-zero if the hardware supports the given or current OpenGL mode.
Definition: Fl_Gl_Window.H:138
void context_valid(char v)
See char Fl_Gl_Window::context_valid() const.
Definition: Fl_Gl_Window.H:133
Fl_Gl_Window(int W, int H, const char *l=0)
Creates a new Fl_Gl_Window widget using the given size, and label string.
Definition: Fl_Gl_Window.H:217
char valid() const
Is turned off when FLTK creates a new context for this window or when the window resizes,...
Definition: Fl_Gl_Window.H:116
int mode(int a)
See Fl_Mode mode() const.
Definition: Fl_Gl_Window.H:176
void valid(char v)
See char Fl_Gl_Window::valid() const.
Definition: Fl_Gl_Window.H:120
Fl_Mode mode() const
Set or change the OpenGL capabilites of the window.
Definition: Fl_Gl_Window.H:174
This widget produces an actual window.
Definition: Fl_Window.H:58
virtual void draw()
Draws the widget.
Definition: Fl_Window.cxx:104
virtual void flush()
Forces the window to be drawn, this window is also made current and calls draw().
Definition: Fl.cxx:1751
void make_current()
Sets things up so that the drawing functions in <FL/fl_draw.H> will go into this window.
virtual void show()
Puts the window on the screen.
virtual int handle(int)
Handles the specified event.
Definition: Fl.cxx:1484
virtual void hide()
Removes the window from the screen.
Definition: Fl.cxx:1372
virtual void resize(int, int, int, int)
Changes the size and position of the window.