class Fl_Gl_Window : public Fl_Window

A window for drawing OpenGL displays into. Each of these windows will have it's own OpenGL context.

To use this, you must subclass it, and implement the draw() method. The draw() method can use any OpenGL functions to draw the window. Flushing the GL stream and swapping buffers is handled automatically by Fl_Gl_Window after draw() returns.

The draw() method can only use OpenGL calls. Do not attempt to call X, any of the functions in <FL/fl_draw.H>, or glX directly. Do not call gl_start() or gl_finish().

Methods:

Fl_Gl_Window::Fl_Gl_Window(int W, int H, const char *l=0);
Fl_Gl_Window::Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)

const int Fl_Gl_Window::mode() const;
int Fl_Gl_Window::mode(int);

int Fl_Gl_Window::mode(const int *);

static int Fl_Gl_Window::can_do(int);
static int Fl_Gl_Window::can_do(const int *mode);
int Fl_Gl_Window::can_do() const;

char Fl_Gl_Window::valid() const;
void Fl_Gl_Window::invalidate();
void Fl_Gl_Window::valid(char i);

void Fl_Gl_Window::ortho();

void Fl_Gl_Window::make_current();
void Fl_Gl_Window::make_overlay_current();
void Fl_Gl_Window::swap_buffers();

void Fl_Gl_Window::hide();
Fl_Gl_Window::~Fl_Gl_Window();

Overlay drawing

GL hardware typically provides some overlay bit planes, which are very useful for drawing UI controls atop your 3D graphics. If the overlay hardware is not provided, fltk tries to simulate the overlay, this works pretty well if your graphics are double buffered, but not very well for single-buffered.

int Fl_Gl_Window::can_do_overlay();

void Fl_Gl_Window::redraw_overlay();

virtual void Fl_Gl_Window::draw_overlay();

static uchar Fl_Gl_Window::overlay_color;

OpenGL drawing functions
#include <FL/gl_draw.H>

Fltk provides some functions that you can use when drawing OpenGL windows. They are defined by including <FL/gl_draw.H>, this header file also includes the OpenGL header <GL/gl.h>.

void gl_color(uchar);

void gl_rect(int x,int y,int w,int h);
void gl_rectf(int x,int y,int w,int h);

void gl_font(uchar fontid, int size);

int gl_height();
int gl_descent();
float gl_width(const char *);
float gl_width(const char *, int n);
float gl_width(uchar);

void gl_draw(const char *);
void gl_draw(const char *, int n);

void gl_draw(const char *, int x, int y);
void gl_draw(const char *, int n, int x, int y);

void gl_draw(const char *, int x, int y, int w, int h, uchar align);

(back to contents)