NTK 1.3.0
gl.h
Go to the documentation of this file.
1//
2// "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
3//
4// OpenGL header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2011 by Bill Spitzak and others.
7//
8// You must include this instead of GL/gl.h to get the Microsoft
9// APIENTRY stuff included (from <windows.h>) prior to the OpenGL
10// header files.
11//
12// This file also provides "missing" OpenGL functions, and
13// gl_start() and gl_finish() to allow OpenGL to be used in any window
14//
15// This library is free software; you can redistribute it and/or
16// modify it under the terms of the GNU Library General Public
17// License as published by the Free Software Foundation; either
18// version 2 of the License, or (at your option) any later version.
19//
20// This library is distributed in the hope that it will be useful,
21// but WITHOUT ANY WARRANTY; without even the implied warranty of
22// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23// Library General Public License for more details.
24//
25// You should have received a copy of the GNU Library General Public
26// License along with this library; if not, write to the Free Software
27// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28// USA.
29//
30// Please report all bugs and problems on the following page:
31//
32// http://www.fltk.org/str.php
33//
34
51#ifndef FL_gl_H
52# define FL_gl_H
53
54# include "Enumerations.H" // for color names
55# ifdef WIN32
56# include <windows.h>
57# endif
58# ifndef APIENTRY
59# if defined(__CYGWIN__)
60# define APIENTRY __attribute__ ((__stdcall__))
61# else
62# define APIENTRY
63# endif
64# endif
65
66# ifdef __APPLE__
67# include <OpenGL/gl.h>
68# else
69# include <GL/gl.h>
70# endif
71
72FL_EXPORT void gl_start();
73FL_EXPORT void gl_finish();
74
75FL_EXPORT void gl_color(Fl_Color i);
77inline void gl_color(int c) {gl_color((Fl_Color)c);}
78
79FL_EXPORT void gl_rect(int x,int y,int w,int h);
84inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
85
86FL_EXPORT void gl_font(int fontid, int size);
87FL_EXPORT int gl_height();
88FL_EXPORT int gl_descent();
89FL_EXPORT double gl_width(const char *);
90FL_EXPORT double gl_width(const char *, int n);
91FL_EXPORT double gl_width(uchar);
92
93FL_EXPORT void gl_draw(const char*);
94FL_EXPORT void gl_draw(const char*, int n);
95FL_EXPORT void gl_draw(const char*, int x, int y);
96FL_EXPORT void gl_draw(const char*, float x, float y);
97FL_EXPORT void gl_draw(const char*, int n, int x, int y);
98FL_EXPORT void gl_draw(const char*, int n, float x, float y);
99FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
100FL_EXPORT void gl_measure(const char*, int& x, int& y);
101#ifdef __APPLE__
102extern FL_EXPORT void gl_texture_pile_height(int max);
103extern FL_EXPORT int gl_texture_pile_height();
104#endif
105
106FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
107
108#endif // !FL_gl_H
109
110//
111// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
112//
This file contains type definitions and general enumerations.
unsigned Fl_Align
FLTK type for alignment control.
Definition: Enumerations.H:658
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:764
unsigned char uchar
unsigned char
Definition: fl_types.h:39
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.
Definition: gl_draw.cxx:298
FL_EXPORT double gl_width(const char *)
Returns the width of the string in the current fnt.
Definition: gl_draw.cxx:56
FL_EXPORT void gl_color(Fl_Color i)
Sets the curent OpenGL color to an FLTK color.
Definition: gl_draw.cxx:328
void gl_rectf(int x, int y, int w, int h)
Fills the given rectangle with the current color.
Definition: gl.h:84
FL_EXPORT void gl_rect(int x, int y, int w, int h)
Outlines the given rectangle with the current color.
Definition: gl_draw.cxx:305
FL_EXPORT void gl_draw(const char *)
Draws a nul-terminated string in the current font at the current position.
Definition: gl_draw.cxx:260
FL_EXPORT void gl_start()
Creates an OpenGL context.
Definition: gl_start.cxx:64
FL_EXPORT void gl_finish()
Releases an OpenGL context.
Definition: gl_start.cxx:105
FL_EXPORT int gl_descent()
Returns the current font's descent.
Definition: gl_draw.cxx:54
FL_EXPORT int gl_height()
Returns the current font's height.
Definition: gl_draw.cxx:52
FL_EXPORT void gl_font(int fontid, int size)
Sets the current OpenGL font to the same font as calling fl_font()
Definition: gl_draw.cxx:78
int gl_texture_pile_height(void)
Returns the current height of the pile of pre-computed string textures.
Definition: gl_draw.cxx:541