FLTK 1.3.3

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Macros | Functions
gl.h File Reference

This file defines wrapper functions for OpenGL in FLTK. More...

`#include "Enumerations.H"`
`#include <GL/gl.h>`

Go to the source code of this file.

## Functions
FL_EXPORT void | gl_color (Fl_Color i)
| Sets the curent OpenGL color to an FLTK color. More...
void | gl_color (int c)
| back compatibility
FL_EXPORT int | gl_descent ()
| Returns the current font's descent.
FL_EXPORT void | gl_draw (const char *)
| Draws a nul-terminated string in the current font at the current position. More...
FL_EXPORT 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...
FL_EXPORT void | gl_draw (const char *, int x, int y)
| Draws a nul-terminated string in the current font at the given position. More...
FL_EXPORT void | gl_draw (const char *, float x, float y)
| Draws a nul-terminated string in the current font at the given position. More...
FL_EXPORT 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...
FL_EXPORT 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...
FL_EXPORT 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...
FL_EXPORT void | gl_draw_image (const uchar *, int x, int y, int w, int h, int d=3, int ld=0)
FL_EXPORT void | gl_finish ()
| Releases an OpenGL context.
FL_EXPORT void | gl_font (int fontid, int size)
| Sets the current OpenGL font to the same font as calling fl_font()
FL_EXPORT int | gl_height ()
| Returns the current font's height.
FL_EXPORT 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.
FL_EXPORT 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...
FL_EXPORT void | gl_start ()
| Creates an OpenGL context.
FL_EXPORT double | gl_width (const char *)
| Returns the width of the string in the current fnt.
FL_EXPORT double | gl_width (const char *, int n)
| Returns the width of n characters of the string in the current font.
FL_EXPORT double | gl_width (uchar)
| Returns the width of the character in the current font.

## Detailed Description

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 yoy try to use a visual not returned by glxChooseVidual.

This does not work with Fl_Double_Window's! It will try to draw into the front buffer. Depending on the system this will 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)

## Function Documentation

FL_EXPORT 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!

FL_EXPORT void gl_draw | ( | const char * | str | ) |

Draws a nul-terminated string in the current font at the current position.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

FL_EXPORT 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.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

FL_EXPORT void gl_draw | ( | const char * | str,
|  | int | x,
|  | int | y
| ) |  |

Draws a nul-terminated string in the current font at the given position.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

FL_EXPORT void gl_draw | ( | const char * | str,
|  | float | x,
|  | float | y
| ) |  |

Draws a nul-terminated string in the current font at the given position.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

FL_EXPORT 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.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

FL_EXPORT 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.

See also
  On the Mac OS X platform, see gl_texture_pile_height(int)

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

FL_EXPORT 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
| ) |  |
| inline

Fills the given rectangle with the current color.

See also
  gl_rect(int x, int y, int w, int h)

- © 1998-2014 by Bill Spitzak and others.