FLTK 1.4.0
Loading...
Searching...
No Matches
gl.h
Go to the documentation of this file.
1//
2// OpenGL header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2018 by Bill Spitzak and others.
5//
6// You must include this instead of GL/gl.h to get the Microsoft
7// APIENTRY stuff included (from <windows.h>) prior to the OpenGL
8// header files.
9//
10// This file also provides "missing" OpenGL functions, and
11// gl_start() and gl_finish() to allow OpenGL to be used in any window
12//
13// This library is free software. Distribution and use rights are outlined in
14// the file "COPYING" which should have been included with this file. If this
15// file is missing or damaged, see the license at:
16//
17// https://www.fltk.org/COPYING.php
18//
19// Please see the following page on how to report bugs and issues:
20//
21// https://www.fltk.org/bugs.php
22//
23
42#ifndef FL_gl_H
43# define FL_gl_H
44
45# include "Enumerations.H" // for color names
46# ifdef _WIN32
47# include <windows.h>
48# endif
49# ifndef APIENTRY
50# if defined(__CYGWIN__)
51# define APIENTRY __attribute__ ((__stdcall__))
52# else
53# define APIENTRY
54# endif
55# endif
56
57# ifdef __APPLE__ // PORTME: OpenGL path abstraction
58# ifndef GL_SILENCE_DEPRECATION
59# define GL_SILENCE_DEPRECATION 1
60# endif
61# if !defined(__gl3_h_) // make sure OpenGL/gl3.h was not included before
62# include <OpenGL/gl.h>
63# endif
64# else
65# include <GL/gl.h>
66# endif // __APPLE__ // PORTME: OpenGL Path abstraction
67
68FL_EXPORT void gl_start();
69FL_EXPORT void gl_finish();
70
71FL_EXPORT void gl_color(Fl_Color i);
73inline void gl_color(int c) {gl_color((Fl_Color)c);}
74
75FL_EXPORT void gl_rect(int x,int y,int w,int h);
76FL_EXPORT void gl_rectf(int x,int y,int w,int h);
77
78FL_EXPORT void gl_font(int fontid, int size);
79FL_EXPORT int gl_height();
80FL_EXPORT int gl_descent();
81FL_EXPORT double gl_width(const char *);
82FL_EXPORT double gl_width(const char *, int n);
83FL_EXPORT double gl_width(uchar);
84
85FL_EXPORT void gl_draw(const char*);
86FL_EXPORT void gl_draw(const char*, int n);
87FL_EXPORT void gl_draw(const char*, int x, int y);
88FL_EXPORT void gl_draw(const char*, float x, float y);
89FL_EXPORT void gl_draw(const char*, int n, int x, int y);
90FL_EXPORT void gl_draw(const char*, int n, float x, float y);
91FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
92FL_EXPORT void gl_measure(const char*, int& x, int& y);
93FL_EXPORT void gl_texture_pile_height(int max);
94FL_EXPORT int gl_texture_pile_height();
95FL_EXPORT void gl_texture_reset();
96
97FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
98
99#endif // !FL_gl_H
This file contains type definitions and general enumerations.
unsigned Fl_Align
FLTK type for alignment control.
Definition Enumerations.H:969
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1103
unsigned char uchar
unsigned char
Definition fl_types.h:30
double gl_width(const char *)
Returns the width of the string in the current fnt.
Definition gl_draw.cxx:59
void gl_rectf(int x, int y, int w, int h)
Fills the given rectangle with the current color.
Definition gl_draw.cxx:232
void gl_rect(int x, int y, int w, int h)
Outlines the given rectangle with the current color.
Definition gl_draw.cxx:216
void gl_color(Fl_Color i)
Sets the curent OpenGL color to an FLTK color.
Definition gl_draw.cxx:253
int gl_height()
Returns the current font's height.
Definition gl_draw.cxx:55
void gl_finish()
Releases an OpenGL context.
Definition gl_start.cxx:90
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:207
int gl_descent()
Returns the current font's descent.
Definition gl_draw.cxx:57
void gl_draw(const char *)
Draws a nul-terminated string in the current font at the current position.
Definition gl_draw.cxx:168
void gl_font(int fontid, int size)
Sets the current OpenGL font to the same font as calling fl_font().
Definition gl_draw.cxx:74
void gl_texture_reset()
To call after GL operations that may invalidate textures used to draw text in GL scenes (e....
Definition gl_draw.cxx:477
void gl_start()
Creates an OpenGL context.
Definition gl_start.cxx:58
int gl_texture_pile_height()
Returns the current maximum height of the pile of pre-computed string textures.
Definition gl_draw.cxx:468