gl.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // "$Id: gl.h 8864 2011-07-19 04:49:30Z greg.ercolano $"
  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. Distribution and use rights are outlined in
  16. // the file "COPYING" which should have been included with this file. If this
  17. // file is missing or damaged, see the license at:
  18. //
  19. // http://www.fltk.org/COPYING.php
  20. //
  21. // Please report all bugs and problems on the following page:
  22. //
  23. // http://www.fltk.org/str.php
  24. //
  25. /** \file gl.h
  26. * This file defines wrapper functions for OpenGL in FLTK
  27. *
  28. * To use OpenGL from within an FLTK application you MUST use gl_visual()
  29. * to select the default visual before doing show() on any windows. Mesa
  30. * will crash if yoy try to use a visual not returned by glxChooseVidual.
  31. *
  32. * This does not work with Fl_Double_Window's! It will try to draw
  33. * into the front buffer. Depending on the system this will either
  34. * crash or do nothing (when pixmaps are being used as back buffer
  35. * and GL is being done by hardware), work correctly (when GL is done
  36. * with software, such as Mesa), or draw into the front buffer and
  37. * be erased when the buffers are swapped (when double buffer hardware
  38. * is being used)
  39. */
  40. #ifndef FL_gl_H
  41. # define FL_gl_H
  42. # include "Enumerations.H" // for color names
  43. # ifdef WIN32
  44. # include <windows.h>
  45. # endif
  46. # ifndef APIENTRY
  47. # if defined(__CYGWIN__)
  48. # define APIENTRY __attribute__ ((__stdcall__))
  49. # else
  50. # define APIENTRY
  51. # endif
  52. # endif
  53. # ifdef __APPLE__
  54. # include <OpenGL/gl.h>
  55. # else
  56. # include <GL/gl.h>
  57. # endif
  58. FL_EXPORT void gl_start();
  59. FL_EXPORT void gl_finish();
  60. FL_EXPORT void gl_color(Fl_Color i);
  61. /** back compatibility */
  62. inline void gl_color(int c) {gl_color((Fl_Color)c);}
  63. FL_EXPORT void gl_rect(int x,int y,int w,int h);
  64. /**
  65. Fills the given rectangle with the current color.
  66. \see gl_rect(int x, int y, int w, int h)
  67. */
  68. inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
  69. FL_EXPORT void gl_font(int fontid, int size);
  70. FL_EXPORT int gl_height();
  71. FL_EXPORT int gl_descent();
  72. FL_EXPORT double gl_width(const char *);
  73. FL_EXPORT double gl_width(const char *, int n);
  74. FL_EXPORT double gl_width(uchar);
  75. FL_EXPORT void gl_draw(const char*);
  76. FL_EXPORT void gl_draw(const char*, int n);
  77. FL_EXPORT void gl_draw(const char*, int x, int y);
  78. FL_EXPORT void gl_draw(const char*, float x, float y);
  79. FL_EXPORT void gl_draw(const char*, int n, int x, int y);
  80. FL_EXPORT void gl_draw(const char*, int n, float x, float y);
  81. FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
  82. FL_EXPORT void gl_measure(const char*, int& x, int& y);
  83. #ifdef __APPLE__
  84. extern FL_EXPORT void gl_texture_pile_height(int max);
  85. extern FL_EXPORT int gl_texture_pile_height();
  86. #endif
  87. FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
  88. #endif // !FL_gl_H
  89. //
  90. // End of "$Id: gl.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
  91. //