FLTK 1.3.2
Fl_Glut_Window Class Reference

GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatability.cxx): More...

#include <glut.H>

Inheritance diagram for Fl_Glut_Window:
Fl_Gl_Window Fl_Window Fl_Group Fl_Widget

List of all members.

Public Member Functions

 Fl_Glut_Window (int w, int h, const char *)
 Creates a glut window, registers to the glut windows list.
 Fl_Glut_Window (int x, int y, int w, int h, const char *)
 Creates a glut window, registers to the glut windows list.
void make_current ()
 The make_current() method selects the OpenGL context for the widget.
 ~Fl_Glut_Window ()
 Destroys the glut window, first unregister it from the glut windows list.

Public Attributes

void(* display )()
void(* entry )(int)
void(* keyboard )(uchar, int x, int y)
int menu [3]
void(* motion )(int x, int y)
void(* mouse )(int b, int state, int x, int y)
int number
void(* overlaydisplay )()
void(* passivemotion )(int x, int y)
void(* reshape )(int w, int h)
void(* special )(int, int x, int y)
void(* visibility )(int)

Protected Member Functions

void draw ()
 Draws the Fl_Gl_Window.
void draw_overlay ()
 You must implement this virtual function if you want to draw into the overlay.
int handle (int)
 Handle some FLTK events as needed.

Detailed Description

GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatability.cxx):


Constructor & Destructor Documentation

Fl_Glut_Window::Fl_Glut_Window ( int  W,
int  H,
const char *  t 
)

Creates a glut window, registers to the glut windows list.

Fl_Glut_Window::Fl_Glut_Window ( int  X,
int  Y,
int  W,
int  H,
const char *  t 
)

Creates a glut window, registers to the glut windows list.


Member Function Documentation

void Fl_Glut_Window::draw ( void  ) [protected, virtual]

Draws the Fl_Gl_Window.

You must subclass Fl_Gl_Window and provide an implementation for draw().

You must override the draw() method.

You may also provide an implementation of draw_overlay() if you want to draw into the overlay planes. You can avoid reinitializing the viewport and lights and other things by checking valid() at the start of draw() and only doing the initialization if it is false.

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().

If double-buffering is enabled in the window, the back and front buffers are swapped after this function is completed.

Reimplemented from Fl_Gl_Window.

void Fl_Glut_Window::draw_overlay ( ) [protected, virtual]

You must implement this virtual function if you want to draw into the overlay.

The overlay is cleared before this is called. You should draw anything that is not clear using OpenGL. You must use gl_color(i) to choose colors (it allocates them from the colormap using system-specific calls), and remember that you are in an indexed OpenGL mode and drawing anything other than flat-shaded will probably not work.

Both this function and Fl_Gl_Window::draw() should check Fl_Gl_Window::valid() and set the same transformation. If you don't your code may not work on other systems. Depending on the OS, and on whether overlays are real or simulated, the OpenGL context may be the same or different between the overlay and main window.

Reimplemented from Fl_Gl_Window.

The make_current() method selects the OpenGL context for the widget.

It is called automatically prior to the draw() method being called and can also be used to implement feedback and/or selection within the handle() method.

Reimplemented from Fl_Gl_Window.


The documentation for this class was generated from the following files: