FLTK 1.4.0
|
This file defines wrapper functions for OpenGL in FLTK. More...
Go to the source code of this file.
Functions | |
void | gl_color (Fl_Color i) |
Sets the curent OpenGL color to an FLTK color. More... | |
void | gl_color (int c) |
back compatibility | |
int | gl_descent () |
Returns the current font's descent. | |
void | gl_draw (const char *) |
Draws a nul-terminated string in the current font at the current position. More... | |
void | gl_draw (const char *, float x, float y) |
Draws a nul-terminated string in the current font at the given position. More... | |
void | gl_draw (const char *, int n) |
Draws an array of n characters of the string in the current font at the current position. More... | |
void | gl_draw (const char *, int n, float x, float y) |
Draws n characters of the string in the current font at the given position. More... | |
void | gl_draw (const char *, int n, int x, int y) |
Draws n characters of the string in the current font at the given position. More... | |
void | gl_draw (const char *, int x, int y) |
Draws a nul-terminated string in the current font at the given position. More... | |
void | gl_draw (const char *, int x, int y, int w, int h, Fl_Align) |
Draws a string formatted into a box, with newlines and tabs expanded, other control characters changed to ^X. More... | |
void | gl_draw_image (const uchar *, int x, int y, int w, int h, int d=3, int ld=0) |
void | gl_finish () |
Releases an OpenGL context. | |
void | gl_font (int fontid, int size) |
Sets the current OpenGL font to the same font as calling fl_font(). More... | |
int | gl_height () |
Returns the current font's height. | |
void | gl_measure (const char *, int &x, int &y) |
Measure how wide and tall the string will be when drawn by the gl_draw() function. | |
void | gl_rect (int x, int y, int w, int h) |
Outlines the given rectangle with the current color. More... | |
void | gl_rectf (int x, int y, int w, int h) |
Fills the given rectangle with the current color. More... | |
void | gl_start () |
Creates an OpenGL context. | |
int | gl_texture_pile_height () |
Returns the current maximum height of the pile of pre-computed string textures. More... | |
void | gl_texture_pile_height (int max) |
Changes the maximum height of the pile of pre-computed string textures. More... | |
void | gl_texture_reset () |
To call after GL operations that may invalidate textures used to draw text in GL scenes (e.g., switch between FL_DOUBLE / FL_SINGLE modes). | |
double | gl_width (const char *) |
Returns the width of the string in the current fnt. | |
double | gl_width (const char *, int n) |
Returns the width of n characters of the string in the current font. | |
double | gl_width (uchar) |
Returns the width of the character in the current font. | |
This file defines wrapper functions for OpenGL in FLTK.
To use OpenGL from within an FLTK application you MUST use gl_visual() to select the default visual before doing show() on any windows. Mesa will crash if you try to use a visual not returned by glxChooseVisual.
Historically, this did not always work well with Fl_Double_Window's! It can try to draw into the front buffer. Depending on the system this might either crash or do nothing (when pixmaps are being used as back buffer and GL is being done by hardware), work correctly (when GL is done with software, such as Mesa), or draw into the front buffer and be erased when the buffers are swapped (when double buffer hardware is being used)
void gl_color | ( | Fl_Color | i | ) |
Sets the curent OpenGL color to an FLTK color.
For color-index modes it will use fl_xpixel(c), which is only right if the window uses the default colormap!
void gl_draw | ( | const char * | str | ) |
Draws a nul-terminated string in the current font at the current position.
void gl_draw | ( | const char * | str, |
float | x, | ||
float | y | ||
) |
Draws a nul-terminated string in the current font at the given position.
void gl_draw | ( | const char * | str, |
int | n | ||
) |
Draws an array of n characters of the string in the current font at the current position.
void gl_draw | ( | const char * | str, |
int | n, | ||
float | x, | ||
float | y | ||
) |
Draws n characters of the string in the current font at the given position.
void gl_draw | ( | const char * | str, |
int | n, | ||
int | x, | ||
int | y | ||
) |
Draws n characters of the string in the current font at the given position.
void gl_draw | ( | const char * | str, |
int | x, | ||
int | y | ||
) |
Draws a nul-terminated string in the current font at the given position.
void gl_draw | ( | const char * | str, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
Fl_Align | align | ||
) |
Draws a string formatted into a box, with newlines and tabs expanded, other control characters changed to ^X.
and aligned with the edges or center. Exactly the same output as fl_draw().
void gl_font | ( | int | fontid, |
int | size | ||
) |
Sets the current OpenGL font to the same font as calling fl_font().
void gl_rect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Outlines the given rectangle with the current color.
If Fl_Gl_Window::ortho() has been called, then the rectangle will exactly fill the given pixel rectangle.
void gl_rectf | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Fills the given rectangle with the current color.
int gl_texture_pile_height | ( | void | ) |
Returns the current maximum height of the pile of pre-computed string textures.
The default value is 100
void gl_texture_pile_height | ( | int | max | ) |
Changes the maximum height of the pile of pre-computed string textures.
Strings that are often re-displayed can be processed much faster if this pile is set high enough to hold all of them.
max | Maximum height of the texture pile |