You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.7KB

  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. /** \file gl.h
  35. * This file defines wrapper functions for OpenGL in FLTK
  36. *
  37. * To use OpenGL from within an FLTK application you MUST use gl_visual()
  38. * to select the default visual before doing show() on any windows. Mesa
  39. * will crash if yoy try to use a visual not returned by glxChooseVidual.
  40. *
  41. * This does not work with Fl_Double_Window's! It will try to draw
  42. * into the front buffer. Depending on the system this will either
  43. * crash or do nothing (when pixmaps are being used as back buffer
  44. * and GL is being done by hardware), work correctly (when GL is done
  45. * with software, such as Mesa), or draw into the front buffer and
  46. * be erased when the buffers are swapped (when double buffer hardware
  47. * is being used)
  48. */
  49. #ifndef FL_gl_H
  50. # define FL_gl_H
  51. # include "Enumerations.H" // for color names
  52. # ifdef WIN32
  53. # include <windows.h>
  54. # endif
  55. # ifndef APIENTRY
  56. # if defined(__CYGWIN__)
  57. # define APIENTRY __attribute__ ((__stdcall__))
  58. # else
  59. # define APIENTRY
  60. # endif
  61. # endif
  62. # ifdef __APPLE__
  63. # include <OpenGL/gl.h>
  64. # else
  65. # include <GL/gl.h>
  66. # endif
  67. FL_EXPORT void gl_start();
  68. FL_EXPORT void gl_finish();
  69. FL_EXPORT void gl_color(Fl_Color i);
  70. /** back compatibility */
  71. inline void gl_color(int c) {gl_color((Fl_Color)c);}
  72. FL_EXPORT void gl_rect(int x,int y,int w,int h);
  73. /**
  74. Fills the given rectangle with the current color.
  75. \see gl_rect(int x, int y, int w, int h)
  76. */
  77. inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
  78. FL_EXPORT void gl_font(int fontid, int size);
  79. FL_EXPORT int gl_height();
  80. FL_EXPORT int gl_descent();
  81. FL_EXPORT double gl_width(const char *);
  82. FL_EXPORT double gl_width(const char *, int n);
  83. FL_EXPORT double gl_width(uchar);
  84. FL_EXPORT void gl_draw(const char*);
  85. FL_EXPORT void gl_draw(const char*, int n);
  86. FL_EXPORT void gl_draw(const char*, int x, int y);
  87. FL_EXPORT void gl_draw(const char*, float x, float y);
  88. FL_EXPORT void gl_draw(const char*, int n, int x, int y);
  89. FL_EXPORT void gl_draw(const char*, int n, float x, float y);
  90. FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
  91. FL_EXPORT void gl_measure(const char*, int& x, int& y);
  92. #ifdef __APPLE__
  93. extern FL_EXPORT void gl_texture_pile_height(int max);
  94. extern FL_EXPORT int gl_texture_pile_height();
  95. #endif
  96. FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
  97. #endif // !FL_gl_H
  98. //
  99. // End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
  100. //